Question
What is the regular expression (in JavaScript if it matters) to only match if the text is an exact match? That is, there should be no extra characters at other end of the string.
For example, if I'm trying to match for abc
, then 1abc1
, 1abc
, and
abc1
would not match.
Answer
Use the start and end delimiters: ^abc$