So, while the regex engine position is still right before the first digit 1 of the subject string, the look-ahead regex \d would have backtracked and matched the string 12. Now, if the look-ahead regex would NOT have been atomic, then a backtracking process could have occured. As no backtracking process can occur, the value of the back-reference \1 will always be 123 ! Therefore, this regex always fails because, obviously, the end of the text is not equal to 123, despite of all the possible backtracking steps of the part \w , located outside the look-ahead structure ! => For instance, the syntaxes (? But the syntaxes (? For instance, the wrong syntax (?-is)(? For instance, the syntaxes (? But the syntaxes (? For instance, the regex (?-i)(? For instance, the regex (?-si)(? For instance, the regex (?=(\d ))\w \1, with a look-ahead, against the text 123x12, will never match ! Indeed, when the regex engine starts, the look-ahead regex \d matches the number 123, which is stored as group 1.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |