Mysql regex for comma delimeted text -



Mysql regex for comma delimeted text -

i have little problem comma delimeted texts stored in database. have string "12,5,45" , match 5 using mysql's regexp function:

agents regexp 'some regex here'

how can accomplish that?

i have ended regexps \5+(,\s*5+)\ or (?:(5)*.)?5+\ matches strings "12,45" or "15,1". need regexp match 5 in strings such as:

"5", "1,3,5", "64,5"

not

"45,12", "1,50".

5 id of element, cannot match 15 or 45 well.

i hope clear.

thanks in advance.

since mysql uses posix engine supports neither word boundary anchors nor lookaround assertions), you'd have cheat bit, using regex like

(^|,)5(,|$)

to create sure match 5 if surrounded commas or start/end of string.

mysql regex comma

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -