There is a line: Сочи (Адлер) (Россия) from which I need to remove the text that is in the last brackets. That is, the text of Россия . For this, I wrote a regular expression:
preg_match('/\((.*?)\)$/', ...); But for some reason it brings me the following matches:
array(2) { [0]=> string(27) "(Адлер) (Россия)" [1]=> string(25) "Адлер) (Россия" } But why? After all, I put at the end of $ , which means the end of the line.
.*\((.*?)\)$- why ... - because you are looking from 1 open bracket to the last open bracket - Alex