Regex To Match Single Or Multiple Lines That End Or Start With Specific Characters

A regular expression to match one or more lines ending or starting with specific characters.

/((.|\n)*)YourCharacter/

Matches:

  • This Is YourCharacter.

Non-matches:

  • YourCharacter is Awesome.
/YourCharacter((.|\n)*)/

Matches:

  • YourCharacter is Awesome.

Non-matches:

  • This Is YourCharacter.