I'd love that. regex is maybe one reason my brain is deteriorating.I would be nice to have a find/replace tool that is as easy to use, without the need of expressions and such, but maybe another time I suppose.
$postsFinder = $this->finder('XF:Post');
/** @var \XF\Entity\Post[] $posts */
$posts = $postsFinder
->where(
'message', 'like',
$postsFinder->escapeLike(
$input['quick_find'], '%?%'
)
)
->order('post_id')
->limit(20)
->fetch();
UPDATE xf_post
SET message = REGEXP_REPLACE(message, '\\[IMG\\]http://[^\\s\\/]+\\.postimg\\.org/[^\\s\\[]+\\[/IMG\\]', 'REMOVED');
image/png;base64,
UPDATE xf_post
SET message = REGEXP_REPLACE(message, '\\[IMG\\]https://forum\\.domain\\.com/image/png[^\\[]+\\[/IMG\\]', '[IMG]https://forum.domain.com/images/404_image.png[/IMG]');
SET GLOBAL regexp_time_limit=0;
UPDATE xf_post
SET message = REGEXP_REPLACE(message, 'Sent from my .+ using Tapatalk', '');
UPDATE xf_post
SET message = REGEXP_REPLACE(message, 'Envoyé de mon .+ en utilisant Tapatalk', '');
UPDATE xf_post
SET message = REGEXP_REPLACE(message, 'Gesendet von meinem .+ mit Tapatalk', '');
UPDATE xf_post
SET message = REGEXP_REPLACE(message, '(Gesendet von meinem .+ mit Tapatalk|Envoyé de mon .+ en utilisant Tapatalk)', '');
I'm not very good with regex. Please help me if you can.
I have hundreds, maybe thousands of links posted in my forum to a 3rd party news site that got hacked, went offline, and has re-emerged, but with a new site (structure). All the old links in my forum now resolve to 404 error pages.
I would like to remove the URL bbcode (just base URL bbcode, not URL= code with special anchor text) wrapped around any links to DOMAIN.COM so that they are no longer live links. Maybe even remove the leading https:// as well. Is this possible with this mod?
https://www.youtube.com
https://youtube.com
http://www.youtube.com
http://youtube.com
#\[url="([^\]]+)"\](.*)\[/url\]#siU
[URL="\1"]\1[/URL]
@Overscan well try this;
Quick Find:
https://www.youtube.com
And non-www of the URL...
https://youtube.com
HTTP;
http://www.youtube.com
And non-www of the URL...
http://youtube.com
Regular Expression:
#\[url="([^\]]+)"\](.*)\[/url\]#siU
Replacement string:
[URL="\1"]\1[/URL]
Please note that do not change. Let's just try it and see what happens.
Just do the replace as \1 not the bbcode variant.
Test the output first before committing to it.
We use essential cookies to make this site work, and optional cookies to enhance your experience.