tlacaelelrl — 2012-05-30T16:05:41-04:00 — #1
I need to update some records using a regex and others trigger them just if they are empty, when they are empty I have no problems but when it is a regular expression I always get an empty result but and I can't figure out how to
The fields look like this
[caption id="" align="alignright" width="180" caption=""]<a href="http://www.medialifemagazine.com/archives/images/collegebag.gif"><img class="size-full" title="collegebag.gif" src="http://www.medialifemagazine.com/archives/images/collegebag.gif" alt="" width="180" height="259" /></a>[/caption]
and this is my regex
^\\[caption +[a-zA-Z=" 0-9\\]<>:/.-]*\\[\\/caption\\]$
Can someone help me out?
r937 — 2012-05-30T16:13:57-04:00 — #2
are you asking for a php solution or a mysql solution?
because mysql REGEXP can only find, not replace
tlacaelelrl — 2012-05-30T16:23:08-04:00 — #3
no, a MySQL, I guess I was doing it wrong, I now have a regex that works
that does find matches but I want to make sure it ends right after [/caption] but when I add $ it does not find anything
I know MySQL does not do search replace but I will be doing something like
post_content = [^[caption .+[/caption]]
I also have to read on this, I think it should be done with CONCAT but first I want to get the regex working
tlacaelelrl — 2012-05-30T16:27:58-04:00 — #4
Okay, I think I have the concat I just need to make sure the regex works and does not modify records I don't want it to, I will be doing something like this
post_content REGEXP '[^[caption .+[/caption]$]'