How to match a pattern which must be preceded by a specific string?
Lets see with an example :
We want to search a string “final
” which must be preceded by “semi
“. Here is two strings below:final
semifinal
Regex will be :
(?<=semi)final
Output :
final
semifinal
Regex Explanation :
(?<= : Starting of Positive Lookbehind.
semi : String that should be preceded by.
) : Ending of Positive Lookbehind.
final : Actual string to match.