in reply to Re^2: REGEX Match Single Digit
in thread REGEX Match Single Digit

That will match just the number 1, and not 11, or 111, etc.

It matches "1" and "1\n" only.

/^1$/:

  1. At the start of the input,
  2. match "1", then
  3. optionally match "\n", then
  4. match the end of the input string.

/^1\z/ will only match "1".