Regular Expression To Match Anything Before Underscore

This is a quick regular expression that matches all content before an underscore(_) in a string.

Can be useful in replacing all characters before an underscore in a set of usernames.



  • regex_pattern
  • 123_456
  • abc_123_456


  • regex-pattern
  • regex pattern
  • regexpattern

See Also:

Regex Is Copied!