For example:
(1) the following pattern matches rose and rosemary, but not primrose:
/brose
(2)Text
Please enter the nine-digit id as it appears on your color - coded pass-key.RegEx/B-/BResultPlease enter the nine-digit id as it appears on your color - coded pass-key.
Analysis
/B-/B matches a hyphen that is surrounded by word-break characters.
The hyphens in nine-digit and pass-key do not match, but the one in color – coded does.
二 :^ matches the start of the input text;
$ matches the end of the input text
For example:
^[Aa] rose // matches "A rose" at the beginning of line [Aa] rose$ // matches "a rose" at end of line
Note:
By default, ^ and $ don't really match the beginning and end of lines
(as defined by carriage return or newline combinations);
they instead match the beginning or end of the entire input text.
Turning on multiline mode with (?m) causes them to match the beginning and end of every line
as well as the beginning and end of input.
Specifically, this means the spot before the first character,
the spot after the last character,
and the spots just after and before line terminators inside the string.