For example, if all entries in a particular column have the form [a-z]+[0-9]+, how can one extract just the leading letters, so that asdf123 and as3456 return ‘asdf’ and ‘as’, respectively?
For example, if all entries in a particular column have the form [a-z]+[0-9]+, how
Share
This is not posible with mysql regex capablities (unless installing some udf’s which appear to be designed for that). Technically, as [0-9] is a limited set you could throw 10
LOCATE‘s inLEAST(watch out for & invalitdate 0), and useSUBSTRING. Not a pretty picture:If you need it look at udf’s. Otherwise you’re just better of fetching the field and manipulate it outside MySQL.
Edit: if the number fits in an integer, dirty hackery could result in :