Answers for "how to define a regular expression in javascript"

6

using regex in javascript

//Adding '/' around regex
var regex = /\s/g;
//or using RegExp
var regex = new RegExp("\s", "g");
Posted by: Guest on May-20-2020
10

regular expression javascript

// Tests website Regular Expression against document.location (current page url)
if (/^https\:\/\/example\.com\/$/.exec(document.location)){
	console.log("Look mam, I can regex!");
}
Posted by: Guest on March-12-2020

Code answers related to "how to define a regular expression in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language