regex - MySQL REGEXP query -
i'm trying select rows in table database has following structure:
<tr> <td> <p><strong>completion date:</strong></p> </td> <td> <p>april, 2012</p> </td> </tr>
but month , year different.
here current query statement:
select * `posts` `content` regexp "<tr>\r\n<td>\r\n<p><strong>completion date:</strong></p>\r\n</td>\r\n<td>\r\n<p>april, 2012</p>\r\n</td>\r\n</tr>"
currently pull rows have april, 2012 expect pull. tried replacing month with: ^[a-za-z]$ did not work nor other combination tired.
could correct regular expression?
thanks,
-m
this should give results looking for. note how need star, means 0 or more [a-za-z]
, , 0 or more [0-9]
characters.
select * `posts` `content` regexp "<tr>\r\n<td>\r\n<p><strong>completion date:</strong></p>\r\n</td>\r\n<td>\r\n<p>[a-za-z]*, [0-9]*</p>\r\n</td>\r\n</tr>"
the caret ^
, dollar sign $
match beginning , end of string. since date not @ beginning, these not match you.
good luck.
Comments
Post a Comment