Regular Expression - Line (Beginning and End)


Page about the definition of line boundary (EOL) in regular expression


Boundary Matcher

You can define the begining or the end of a line with boundary matcher

boundary matcher Description
^ The beginning of a line
$ The end of a line


The end of line pattern are shorthand that defines the end of line whitespace character

The boundary matcher should be used but for the sake of the example, the below pattern will match an end of line on any system (windows, linux, …)



  • \r defines the carriage return character
  • ?? is a lazy quantifier that will match once or not at all
  • \n defines the linefeed character itself and is mandatory on all platform

Powered by ComboStrap