regex anyone? (php MYSQLR)
PATX
2,820 Posts
Hi,
Anyone here got experience with cleaning MySQLs with regex? php or whatever works. I need pointers, including how not to break everything.
Anyone here got experience with cleaning MySQLs with regex? php or whatever works. I need pointers, including how not to break everything.
Comments
whats the issue dude?
Problem is that Ckeditor installs Scayt (spell check as you type - the red squiggly lines you see in the composer window here on strut for example) and these squiggly lines are in fact a whole lot of bullshit tags that have now been saved to the file. I need them out, but they are not all the same. I have removed Scayt, but the damage is done for the records that have been edited in the meantime. It's a 100+ records in multiple places.
So I guess I need to export the sql file, run a regex on it to remove these tags, then re-import the sql. This scares me a bit.
The bit I need to edit looks like this pattern:
I want to remove, in this case
and
Im guessing the data-scayt_word="blahblah" and id=blah are the parts that are different?
Thanks for the link. I am still scared of running this on a whole database! Will make many copies first.
You could just strip any tags with this regex:
that will match any tags in a string, processing is up to you
Is this really the sexiest thread on ss today?
This will match the opening span tag with the data_scayt attribute (as long as the attribute is the first attribute) and the matching closing span. This'll f up if you've got unclosed tags or your source isn't somehow well-formed....
You will end up matching the entire string instead of matching the first span and it's closing tag.
Had to edit because I forgot the spans would be removed