Regex To Match Characters Between Two Strings

A regular expression to match all characters between two strings you specify.

/(?<=This is)(.*)(?=regex)/

Matches:

  • This is awesome regex.
  • This is cool┬áregex.
  • This is awesome regexpattern.

Non-matches:

  • It is awesome regex.
  • This is awesome pattern.

See Also:

Regex Is Copied!