Regex To Match Everything After A Specific Character

A regular expression that matches everything after a specific character (like colon, word, question mark, etc.) in a string.

Can be used to replace or remove everything in the text that starts with a certain character.

Note that don’t forget to replace the FOO as displayed below.

/\FOO(.*)/g

Matches:

  • FOOAbcdefg
  • FOO1234567
  • FOOABCDEFG

Non-matches:

  • FOAbcdefg
  • AFOObcdefg
  • 1234567FOO

See Also:

Regex Is Copied!