Monday, 20 April 2015

Regular Expression Anchors

"Regex anchors force the regex engine to start or end a match at an absolute position. The start of string anchor (\A) dictates that any match must start at the beginning of the string."

"The end of line string anchor (\Z) requires that a match end at the end of a line within the string."

"The word boundary anchor (\b) matches only at the boundary between a word character (\w) and a non-word character (\W)."

Cited from Regular Expressions and Matching

##################################################
✽ In .NET, Perl and Ruby, \Z is allowed to match before a final line feed. Therefore, e\Z will match the final e in the string "apple\norange\n".

Cited from Regex Anchors

 


No comments:

Post a Comment