I try a regex, but the result is not really that I want.
This is my regex :
/^(([a-z]{0,})([0-9]+)).*/i
And this is my strings :
8500A.JPG //I need to get 8500A but I get 8500
0130799.JPG // I get the good result : 0130799
How to keep alphabetical characters before the .JPG ?
Looks like you may have been getting enclosing parenthesis confused.
inside the character class you can specify many ranges
To break down what it is doing:
More info here:
http://www.regextester.com/pregsyntax.html
Hope that helps