How to delete all the characters in the string except the characters in brackets (preg_replace)?

How to delete all the characters in the string except the characters in brackets
example
Alpe(_4043()вапdsff)rtnbe' => _4043()вапdsff

Thought to replace the first half before the"(" and then starting with the extreme "(" to the end or only the XS as you can in one regular season all (not good in regular expressions)
June 5th 19 at 21:05
1 answer
June 5th 19 at 21:07
If you do not Excel with attachments, you need to find any number of any characters between the parenthesis symbol: (.+) and just to get them out. Brackets below were not included in sample - apply ago looking (for the first parenthesis) and forward looking (at last): (?<=\().+(?=\))
Demo: https://regex101.com/r/XBrb9s/1

On Wikipedia, a very sensible article on regexps, I recommend: https://ru.wikipedia.org/wiki/Регулярные_выражения...
If you Excel with attachments and working with preg_replace https://regex101.com/r/XBrb9s/2 - naomie commented on June 5th 19 at 21:10

Find more questions by tags Regular expressions