Answers for "how to match exact in regex js"

1

regex match exact string

you want to achieve a case insensitive match for the word "rocket" 
surrounded by non-alphanumeric characters. A regex that would work would be:

\W*((?i)rocket(?-i))\W*
Posted by: Guest on August-23-2020
1

javascript regex exact match

var r = /^a$/

function matchExact(r, str) {
   var match = str.match(r);
   return match && str === match[0];
}
Posted by: Guest on May-08-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language