How to detect regex pattern for strings with underscore?

Member

by mac , in category: Third Party Scripts , 5 days ago

How to detect regex pattern for strings with underscore?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lottie , 4 days ago

@mac 

To detect regex patterns for strings with underscore, you can use the following regular expression:

1
^.*_.*$


Explanation:

  • ^ : asserts position at start of the string
  • .* : matches any character (except for line terminators) zero or more times
  • _ : matches the underscore character
  • .* : matches any character (except for line terminators) zero or more times
  • $ : asserts position at the end of the string


This regex pattern will match any string that contains at least one underscore character.