I want to check that an input string is a valid shareable Google Forms URL. The requirement is that the input string starts with 'https://docs.google.com/forms/'
and ends with 'viewform?usp=sf_link'
. I would like to use the .match() with a regex function to accomplish this.
My current function is
isFormsUrl(inputString) {
return inputString.startsWith('https://docs.google.com/forms/') && inputString.endsWith('viewform?usp=sf_link');
}
This function works but I'd like to use regex match() instead of the startsWith() and endsWith() functions to stay consistent with my current codebase. I am very unfamiliar with regex. Thanks!