Beginning And End - YouTube

at the beginning vs. in the beginning -

Beginning and Intermediate Algebra: Student Solutions Manual

This seems like it should be trivial, but I'm not so good with regular expressions, and this doesn't seem to be easy to Google.

So far as I am concerned, I don't care what characters are in between these two strings, so long as the beginning and end are correct.

If you're searching for hits within a larger text, you don't want to use ^ and $ as some other responders have said; those match the beginning and end of the text. Try this instead:

\b is a word boundary : it matches a position that is either preceded by a word character and not followed by one, or followed by a word character and not preceded by one. This regex will find what you're looking for in any of these strings:

\w+ matches one or more "word characters" (letters, digits, or _ ). If you need something more inclusive, you can try \S+ (one or more non-whitespace characters) or .+? (one or more of any characters except linefeeds, non-greedily). The non-greedy +? prevents it from accidentally matching something like dbo.func1_fn dbo.func2_fn as if it were just one hit.

It would be better, however, to use the string manipulation functionality of whatever programming language you're using to slice off the first four and the last three characters of the string and check whether they're what you want.