regex MDN code example
Example 1: javascript new Regexp with flag
new RegExp(/ab+c/, 'i')
new RegExp('ab+c', 'i')
const pattern='some pattern';
new RegExp(pattern)
Example 2: les fonctions reguliere javascript
if(! pseudo.match(/^([a-zA-Z ]+)$/))
alert('Pseudo invalide');
Example 3: js string to regex
const regex = new RegExp('https:\\/\\/\\w*\\.\\w*.*', 'g');
Example 4: using regex in javascript
var regex = /\s/g;
var regex = new RegExp("\s", "g");
Example 5: regex for strings with specific letters javascript
let re = /ab+c/;
Example 6: regular expression javascript
if (/^https\:\/\/example\.com\/$/.exec(document.location)){
console.log("Look mam, I can regex!");
}