Given a string str = "Senior Software Engineer (mountain view)"
How can I match everything until I hit the first parenthesis, giving me back "Senior Software Engineer"
you would use ^[^\(]+
to match that and then trim it to remove the trailing space
^[^\(]*
[^\(]
is a character class, which matches everything except for (
, and *
is a greedy match, which matches the class as many times as possible. The ^
at the beginning matches from the beginning of the string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With