Computer science: a bit about regex anchors
Self-tutoring about regular expressions: the tutor mentions a possible misstep.
It’s true that, typically, in regex, ^ means beginning and $ means end – particularly outside of [].
Consider the string s1: “Hello there Smedley!”
The pattern ^there$ won’t find a match in s1, at least not in my experience. However, ^Hello will; also, ley!$ will.
Source:
Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.
Leave a Reply
You must be logged in to post a comment.