So suppose you have a word to search in a paragraph this is how regex based engine will search it.
Text : Hello World you are learning regex and trying to search a Word in this line.
Regex Search : Word
So the in text ” Hello World you are learning regex” you are searching for word “World” using regex, regex engine will first match for the letter “W” with the letter “H”, since this is not a match it will try matching “W” with the next letter that is “e”, this still not a match then it will proceed with next letter “l” and so on util it reaches the letter “W” at position 7(including space), since it is a match regex engine will now search letter “o” with “letter right next the letter “W” which is “o” it is still a match then the next letter “r” and it is still a match but the next regex word is “d” but the letter right next to “r” in the text is “l” which is not match. so regex engine will now again compare the letter “l” with the first word of the regex that is “W” it is still not a match hence it will proceed with the letter “d” of the text to compare with “W” and search moves on util it it meets letter “W” again.
Note : Regex engines are case sensitive by default