mysql where string ends with numbers -
my table column contains values like:
id | item ------------- 1 | aaaa11a112 2 | aa1112aa2a 3 | aa11aa1a11 4 | aaa2a222aa
i want select rows value of item ends numbers. there this?
select * table item '%number'
you can use regexp
, character class
select * table item regexp '[[:digit:]]$'
explanation:
[[:digit:]] >> match digit characters $ >> match @ end of string
within bracket expression (written using [ , ]), [:character_class:] represents character class matches characters belonging class.
sidenote:
other helpful mysql character classes use regexp
, taken documentation:
character class name meaning alnum alphanumeric characters alpha alphabetic characters blank whitespace characters cntrl control characters digit digit characters graph graphic characters lower lowercase alphabetic characters print graphic or space characters punct punctuation characters space space, tab, newline, , carriage return upper uppercase alphabetic characters xdigit hexadecimal digit characters
Comments
Post a Comment