Regular Expression - Line (Beginning and End)

Regexp

About

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

Pattern

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

Characters

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??\n

where:

  • \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





Discover More
Regexp
Regexp - Dot (Single Character pattern)

Dot . in a regular expression matches any character in the supported character set with this characteristic, by default: newline characters are not included without setting a flag. See matchnewline...
Regexp
Regular Expression - Boundary Matcher

The boundary matcher meta Symbol Description ^ The beginning of a line $ The end of a line \b A word boundary \B A non-word boundary \A The beginning of the input \G The end of the previous...
Data System Architecture
Text - Carriage Return (CR) Character

The carriage return (CR) is a control character. It: is the end of line (EOL) on Macintosh and one EOL element for Windows. moves the cursor back to the beginning of the line in a console. ...



Share this page:
Follow us:
Task Runner