I found a regex pattern for PHP that does the exact OPPOSITE of what I’m needing, and I’m wondering how I can reverse it?
Let’s say I have the following text: Item_154 ($12)
This pattern /\((.*?)\)/ gets what’s inside the parenthesis, but I need to get “Item_154” and cut out what’s in parenthesis and the space before the parenthesis.
Anybody know how I can do that?
Regex is above my head apparently…
Match everything from the start of the string until the first space or
(.If the item you need to match can have spaces in it, and you only want to get rid of whitespace immediately before the parenthetical, then you can use this instead: