Resource icon

Post Content Find / Replace 2.0.1

No permission to download


Well-known member
This should be youtu ;)
Oh, bad, bad, typo... I will change it.

Something is wrong with step 3. It is returning results with one letter like this:
Just pu it in the and look whats wrong. I try it again with the test-strings from above and step 3 works for me.
Things you should control (with
  • do you use the right one replacement? The number after the $ changed in my replacement strings - take a look at that
  • if that is realy OK, put my step 3 regex code (without # at the begining and #siU at the end !!) in the,

    Cklick at "flags" right above the regex input field and control, multiline and global are selected.

    put these test-strings in the test string text field:

    When you now mouse over the test-strings, a overlay should open with more info like this:

    As you can see then, we need group #3 (the video IDs)

    and use these replace string in subtitition field:

    The $3 means that at this place comes that what our matchesfound at group #3 short bevore.

    then you also should become such a example replacements:

    xxxxx stands symbolic fore your video-ID

    If so - the regex work, go back to the find posting and replace tool at your Xenforo und try a new test run. Dont forgett to add now the # at beginning and the #siU at the end of the regex when you copy it to Xenforo.
    If not - make certain screenshots out of your so I can see the overlay open and all other input fields. :)


Well-known member
I'm about to give up 😭
Now I get this
ErrorException: [E_WARNING] preg_match_all(): Unknown modifier '(' in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41
preg_match_all() in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41
XFPR\Admin\Controller\PostReplace->actionReplace() in src/XF/Mvc/Dispatcher.php at line 350
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 257
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 113
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 55
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2344
XF\App->run() in src/XF.php at line 512
XF::runApp() in admin.php at line 13


Well-known member
Read carefull what i wrote...

FIRST: what was with ? Errors? Or do it run as it should run?

Then - control your regex at missing # and #siU.
regex for

same with # and #siU as regex for Xenforo:

Do you see it? I think its an copy and paste problem... ;)

If you realy dont can run it, send me account data so I can take a look direct at your forum. Otherways we discuss the next days... and doesnt go forward. :) ;)


Well-known member
Pasting correctly:




FIRST: what was with ? Errors? Or do it run as it should run?
Sorry I tried that site, but don't know how to use it.
Last edited:


Well-known member
Ok, I see whats going up:

Thats simply a not complete video-ID match - I think your links are others then the hand full I have to test with regextester.

To look whats going wrong, I need The komplete links from post #5153, #9114, #9594 and #13132 so I can take a look why it is not match the correct way. I think its not a big trouble and fast to fix. :)

How to use
1628924893155.png 1628925261998.png 1628925888511.png

Damn - look complicated, but it isnt. :D ;)
Last edited:


Well-known member
Can anyone help change these to MEDIA=youtube bb code?


(both those are plain text, no bb code)



I ran steps 1 and 2 from @otto and they worked for those instances, these are the ones I have left but his steps he has been trying to help me with are not working.


Well-known member
Sorry, but you don't seem to really understand how the tool (serach and replace) works and so you make it almost impossible for me to help you ... :(

If the quick search for:
can only find 2 posts, then there are only 2 posts with this search term!

This is not only the fault of my regex code, but that you provide information that is apparently not quite correct.

What happens if you try to shorten the quick search?
e.g .:
: //
or even just
: // youtu

Does the quick search now find only 2 posts? Or more?

The regex code from me can only be used on posts that the quick search of the Serach and Replace tool found!
If the quick search can only find 2 posts, then there are only 2 posts that contain the search term of the quick search.

I asked you to give me the complete links from the posts that the quick search finds, but where the regex match fails. Did you give me this - NO.

What is possible, that this is about video-ids that contain not only 0-9, a-z, A-Z as well as "-" and "_" but also other special characters. But to check that and if necessary to include it in the regex, I would have needed the complete links and I never got them from you!

my last 50 cents to your problem:
Open the two postings from the screenshot:
copy the COMPLETE links from the editor (toggle bbcode mode) and let's see what the video links and special video ids look like.

Then I could tell you why the regex doesn't work for you. And that’s what I’ve asked you twice now!

Not only did I give you the regex codes, but I also offered to have a look at it in your forum to help solve the problem. I also asked you for the exact links from the posts where the regex failed so far. But I never got it.

But each time there are only slightly different links than previously indicated.

I asked you to test your links on I have described to you several times (in text and picture) how to do this very easily. And I asked you for screenshots too ...

  • no link to the forum and so no possibility to look directly why my regex code is running in the tester, but not in your forum
  • no screenshots as requested
  • no serious attempt with the regex tester - I claim everyone who can use a computer should also be able to simply fill 3 text fields with given values (I gave them to you for copy and paste as text and as screenshots!) and then from Result to take a screenshot.
You want to be able to use the Post serach and replace tool but not want to do almost the same thing in the regex tester? Realy?

Sorry, but they CAN'T really help you like that. And now, after several days try to help, I no longer want to sacrifice my free time for it. It just doesn't make sense if you don't do what people ask you to do multiple times to help you.


Well-known member
RegEx search:
At this sample your random can contain a-z, A-Z and/or 0-9 but nothing others.

Leave in this case blank to remove all found blocks/groups from your posts.

If random is more as only alphanumeric, then you have to change the regex block/group at the middle like this eg:
... you can add the things you want to search for at the middle block/group in this case.

If your random can also contain whitespace(s) eg, add a \s in the middle block/group. For backslash(es) use \\ eg.
Here I also added a \s at the 3. block/group end to find also the whitespace at the end of our search and remove them later to so you dont have after removing a sensless double whitespace in your posts.
Thanks a lot for the advice, but all of the 3 REGEX doesn't work based on my test.
Demo attached.

View attachment Screen Recording 2021-08-17 at 7.27.41 PM.mp4

Edit, I got it now. :)

Last edited:


Well-known member
Thats why I say, try it first with regextester - regextester is your friend. :D ;)

Yes my regex cant work, with these infos:
Post content format:
At your bbcodes with more complex random string. Regex can only find what you say Regex they have to find.

Congrats to your working regex code, you see its not impossible to make a own working one. :) (y)

Ah, I see - you do one wrong step and copy the "#" and "#siU" to regextester - yes, this wont work at regextester, as you can see at my screenshot in the post you quotet:

To only thing my code miss was the upper comma, after insert them it works:

But I found a possible little thing that you should change at the end of the regex code:
Try to ad back the "\s" at the end, to match one whitespace after your bbcode so when the bbcode is inserted inline betwen text you will not have a double whitespace there.


Otherwise it looks like that:
Last edited:


Well-known member
You can also made a shorter one, shorter is often better in performance by regex. ;)

The "\w" match also all alpha-numeric and underscore characters (works prety much same as "0-9a-zA-Z") .

And also a little bit better can be this one:

Here we look for uppercase OR ( this means the | ) lowercase: CQ or cq and we put this in a own group #2 to reuse them later in our regex code with (\2). :)
Last edited:


Well-known member
Sorry, but they CAN'T really help you like that. And now, after several days try to help, I no longer want to sacrifice my free time for it.
FREE time, hey, I told you I wanted this to be a paid job and you refused my paypal offer. :) I do appreciate that you wanted to help for free. If you would have taken the money, it would have been PAID time! ;)

I'm going to try to look over all your notes and figure it out. Like I said, it's MUCH appreciated!

Paying Make It Rain GIF by Travis
Last edited:


Well-known member
I'd like to make the replacement somewhat more useful, instead of removing it completely... I'd like to convert it to tag/@/mentions instead :).
Sample old post content:
[CQ='User_101, c: 1399153, m: 413875'][/CQ]
[CQ='User_102, c: 1392392, m: 897619'][/CQ]
[CQ='User_103, c: 1392387, m: 1789649'][/CQ]
[CQ='user_104, c: 1404633, m: 642866'][/CQ]
[CQ='User 105, c: 1403625, m: 642866'][/CQ]
[CQ='User-106, c: 1403675, m: 524468'][/CQ]
[CQ='User-107, c: 1403551, m: 524468'][/CQ]

Only a-Z, 0-9, space, underscore, and hyphen in any order are allowed in the username.
c: xxxxxxx is the comment ID from old addon.
m: 123456 is the UserID

I'd like it to convert to:
@User 105

This seems more tricky, I'm not sure what code to use on the Replace field.


Well-known member
For some reason,
#([\[CQ\=']+)([\w\-\s]+)([c:\s0-9,m'\]\[\/CQ\]]+)#siU doesn't work, but
#([\[CQ\=']+)([\w\-\s]+)([c:\s0-9,m'\]\[\/CQ\]]+)#si works fine :/.


Well-known member
FREE time, ...
You don't get me right - if I had taken money, my free time would still be wasted. And your money too. ;)
If you do not respond appropriately to simple inquiries and the basics are not understood, I cannot help you properly. :(
Look at @rdn - here I can see they have understand the basics and as you can see we find working solutions at short times.

No one can replace free time with money. ;)
Last edited:


Well-known member
How to add a single space before and after the Replacement string?
\n and \t doesn't even work.



Well-known member
Seems I got it?
When "userxxx" will be the real usernames - than this should work in your case.

You can safely try a run at one posting - just make the fast find more concrete to find only one posting and then let the tool run.
After that control this one post and check the result.
When its positiv, you can run with more posts matching shorter faste search term to let the tool run at more posts.
  • Like
Reactions: rdn


Well-known member
How to add a single space before and after the Replacement string?
\n and \t doesn't even work.
What when you use simply a " " (whitespace) instead \n or \t ? I think \s like at the regex code will not work at replacement string - but I havent tested yet.