Last updated on

Regex (regular expressions) is such an amazing technology. It’s the most popular (and certainly powerful) text search engine.

How to

  • Match all the caracters between 2 strings
# expression
(?<=This is)(.*)(?=sentence)
# this matches
This is "just a simple" sentence

The pattern looked closely:

(?<=\s|^)         #to look behind the match
(stackoverflow)   #the string you want. () optional
(?=\s|$)          #to look ahead.

source: StackOverflow