Answers for "positive lookbehind regex explained"

5

regex lookbehind

# Positive lookahead
q(?=u)   # Matches the letter "q" if "q" is followed by the letter "u"
# Negative lookahead
q(?!u)   # Matches the letter "q" if "q" is NOT followed by the letter "u"
# Positive lookbehind
(?<=a)b  # Matches the letter "b" if "b" is preceded by the letter "a"
# Negative lookbehind
(?<!a)b	 # Matches the letter "b" if "b" is NOT preceded by the letter "a"
Posted by: Guest on June-30-2021

Browse Popular Code Answers by Language