2015-02-22, 08:58 AM
Hi,
I converted the standard align MyCode to be simply one word MyCodes...
But I have thousands of posts...
Since MyCodes are open/close types of shortcodes, is there a way to run MySQL commands to run through the table rows and replace
to
I want to just clean up everything to be uniform through out the forum.
Finding and replacing a single string is easy but the logic to also change the nearest matching closing tag seems beyond the scope of any MySQL commands I am aware of?? Even if I were to export the database and manually use search and replace, it won't cover the logic needed to do the proper replacing I need. Thanks for any help.
Update:
Please see Post #17 for the logic problem we came up against.
currently
does not account for nesting issues, validly nested tags should be what's replaced while the invalidly nested groups should be left alone so I can go in and change them manually. At least that's what it seems would solve the issue.
SOLVED!
This works perfectly in Sublime Text with grep enabled in Search and Replace:
Search (grep):
I converted the standard align MyCode to be simply one word MyCodes...
But I have thousands of posts...
Since MyCodes are open/close types of shortcodes, is there a way to run MySQL commands to run through the table rows and replace
[align=center]****ignore everything between till closing tag****[/align]
to
[center]****ignore everything between till closing tag****[/center]
And the same for left,right, and justify.I want to just clean up everything to be uniform through out the forum.
Finding and replacing a single string is easy but the logic to also change the nearest matching closing tag seems beyond the scope of any MySQL commands I am aware of?? Even if I were to export the database and manually use search and replace, it won't cover the logic needed to do the proper replacing I need. Thanks for any help.
Update:
Please see Post #17 for the logic problem we came up against.
currently
\[align=(center|justify|left|right)\](.*)\[/align\]
does not account for nesting issues, validly nested tags should be what's replaced while the invalidly nested groups should be left alone so I can go in and change them manually. At least that's what it seems would solve the issue.
SOLVED!
This works perfectly in Sublime Text with grep enabled in Search and Replace:
Search (grep):
\[align\=(left|center|right|justify)\](.*?)\[/align\]
Replace:[$1]$2[/$1]