I am trying to understand PHP preg_replaceand was wondering if you can offer any recommendations on how to line the word in brackets, but remove everything else from this line:
Events (Road)
So he will return:
Road
I really want to learn, so I do not just need an answer, but I need to understand how this is possible.
I know how to remove words in brackets (and brackets) with
trim(preg_replace('/\s*\([^)]*\)/', '', 'Events (Road)')
Cheers r
source
share