PHP Regex to match the last occurrence of a string
问题 My string is $text1 = 'A373R12345' I want to find last none digital number occurrence of this string. So I use this regular expression ^(.*)[^0-9]([^-]*) Then I got this result: 1.A373 2.12345 But my expected result is: 1.A373R (It has 'R') 2.12345 Another example is $text1 = 'A373R+12345' Then I got this result: 1.A373R 2.12345 But my expected result is: 1.A373R+ (It has '+') 2.12345 I want contain the last none digital number!! Please help !! thanks!! 回答1: $text1 = 'A373R12345'; preg_match(