[Solved] What’s the meaning of ^ and $ symbols in regular expression? [duplicate]


^ is beginning of input and $ is the end of it.

e.g.

  • ^[0-9] – everything that starts from a digit
  • [0-9]$ – everything that ends with a digit

And a little bit more detailed description from wiki:

  • ^ Matches the starting position within the string. In line-based tools, it matches the starting position of any line.
  • $ Matches the ending position of the string or the position just before a string-ending newline. In line-based tools, it matches the ending position of any line.

solved What’s the meaning of ^ and $ symbols in regular expression? [duplicate]