Monday, April 26, 2021

Practice with Regular Expressions

^[a-z]*p[a-z\s]{1}t[a-z]*$
^ indicates the beginning of a string or line, and $ indicates the end
/s is space

                           [a-z] means any of the lower case letters a-z
                           [a-z]* means any of the lower case letters a-z repeated 0 or more times
                               This is followed by the letter p
                               [a-z\s]{1} means any of the lowercase letters a-z or space exactly one time
                               This is followed by the letter t. (Exactly one lowercase letter or space is between the p and t in the column on the left
                               [a-z]* means any of the lower case letters a-z repeated 0 or more times after the t
                               and $ means you reached the end of the string.