Resource icon

Post Content Find / Replace 1.0.0

No permission to download
Alright well unless I have access to the post replacement tool on your board I could not tell you why that is...what I can show you is this...

URLs to catch
[URL='http://www.travelstories.gr/glossary/whateverhereagain']Barcelona[/URL]
[URL='http://www.travelstories.gr/glossary.php?do=item&id=42']Barcelona[/URL]


PHP:
preg_match_all #\[url='http://www.travelstories.gr/glossary(?:.|/)[^]]+]([^]\[]+)(\[/url])#siu

OUTPUT:

  [0]=> array
    [0]=>[URL='http://www.travelstories.gr/glossary/whateverhereagain']Barcelona[/URL]
    [1]=>[URL='http://www.travelstories.gr/glossary.php?do=item&id=42']Barcelona[/URL]
  [1]=> array
    [0]=>Barcelona
    [1]=>Barcelona
  [2]=> array
    [0]=>[/URL]
    [1]=>[/URL]

Which shows that at the very least that the two links you shared earlier would be caught, if they are not being caught it says they were either already replaced, or they don't exist anymore otherwise.
 
If you want to take a look I can give you access. If you don't have time no problem you already helped a lot :)
 
hi,

How to change this kind of bbcode to work with xenforo

[youtube]youtubeurl[/youtube]

And

[align=center]lot of text [/align]

Thank you
 
Hey mate.

Code:
[URL='http://www.youtube.com/watch?v=Fp5O4FuVdnI']Veena Malik's ISI tattooed picture controversy investigation completed ( EXCLUSIVE) - YouTube[/URL]

This URL is not getting picked up.
 
Hey mate.

Code:
[URL='http://www.youtube.com/watch?v=Fp5O4FuVdnI']Veena Malik's ISI tattooed picture controversy investigation completed ( EXCLUSIVE) - YouTube[/URL]

This URL is not getting picked up.
What's pop'n...this should do the trick for that

Quick Find:
Code:
[url


Regular expression:
Code:
#(?:\[url=')http(?:s)?://(?:www\.)?(?:[a-z0-9-]+\.)?youtu(?:be\.com/(?:[a-z]+(?:/api/videos/)?)|\.be)(?:\?v=|/)?([a-z0-9_-]{11})(?:[^\s]+)?('])[^\[]+(?:\[/url])#siu


Replacement String:
Code:
[media=youtube]\1[/media]
 
I installed this (I think) But when I click on Tools>Replace in Posts I get an error:

The requested page could not be found.

can anyone please help?

However I am a bit confused by the manual

  1. Upload the add-ons files into your XenForo installation. This will usually create a new directory within the library/ directory in your XenForo installation. In general, this shouldn’t overwrite any existing files.
I uploaded folders from the addon on to the library directory as outlined above, is that correct?
 
Last edited:
You need to upload the /PostReplace folder so your structure would be /library/PostReplace. What you have done is upload the contents of the /PostReplace folder, but all those folders should be as sub-directories of /library/PostReplace
 
OK, got it working I think, but I'm a bit confused as to what to put to replace the videos.

This is the example in the addon instructions:

Code:
[video="http://www.youtube.com/watch?v=ZSW4LDAHIeU"]Video title here[/video]

But the source BBcode I have is different, they seem to be either:

Code:
[video=youtube;g0uAlX9RSEI]http://www.youtube.com/watch?v=g0uAlX9RSEI[/video]

or

Code:
[video=youtube_share;gQV8yReZQY8]http://youtu.be/gQV8yReZQY8[/video]

So what should I use as Regular Expression and Replacement String?

Thanks
 
The replacement I linked in your previous thread should account for the first source BB Code, you'll need a separate one for the second one.
 
The replacement I linked in your previous thread should account for the first source BB Code, you'll need a separate one for the second one.

Thanks.

Would it just be
Code:
#\[video\=(youtube_share)\;([a-z0-9-_]+)\][^\[]+\[\/video\]#siu
Instead of

Code:
#\[video\=(youtube)\;([a-z0-9-_]+)\][^\[]+\[\/video\]#siu
 
Most likely, I haven't tested but you can probably use:
Code:
#\[video\=(youtube|youtube_share)\;([a-z0-9-_]+)\][^\[]+\[\/video\]#siu
 
Code:
[video=youtube;g0uAlX9RSEI]http://www.youtube.com/watch?v=g0uAlX9RSEI[/video]
Code:
[video=youtube_share;gQV8yReZQY8]http://youtu.be/gQV8yReZQY8[/video]

Quick Find:
Code:
[video


Regular expression:
Code:
#\[video=(?:youtube(?:_share)?);([^]]+)[^\[]+\[/video]#siu


Replacement String:
Code:
[media=youtube]\1[/media]
 
Well, almost worked. I tried it without ticking the "save changes" box and the test results looked fine, however when going for it with box ticked I got this error:

Error
Please enter a message with no more than 5 pieces of media.

ScreenSnapz002.gif
 
Well, almost worked. I tried it without ticking the "save changes" box and the test results looked fine, however when going for it with box ticked I got this error:



View attachment 61231
Before running that expression go to:

ACP -> options -> messages
Maximum Media Embeds per Message -> set this to 0 while you are running the replacement.

Run the replacement, and then set the Maximum Media Embeds per Message back to a number suitable to your preference.
 
It will as long as the strings to be replaced are in some sort of retreating pattern and it appears they are... (this will not fix the titles though, just the post content)

I have a few minutes now if you want send me a link to that post.
 
Last edited:
Use these, then let me know if you find any more weird string that are similar but different.


Quick Find:
Code:
â


Regular expression:
Code:
#‘|’#siu


Replacement String:
Code:
'
________________________________________

Quick Find:
Code:
â€


Regular expression:
Code:
#…#siu


Replacement String:
Code:

____________________________


Quick Find:
Code:
â


Regular expression:
Code:
#“#siu


Replacement String:
Code:
"

____________________________


Quick Find:
Code:
â


Regular expression:
Code:
#–#siu


Replacement String:
Code:
 
Last edited:
Use these, then let me know if you find any more weird string that are similar but different.


Quick Find:
Code:
â


Regular expression:
Code:
#‘|’#siu


Replacement String:
Code:
'
________________________________________

Quick Find:
Code:
â€


Regular expression:
Code:
#…#siu


Replacement String:
Code:
,
I get a white screen with this error. JUST with the first one you gave me (â), the second seems to find the codes on the test mode.

Fatal error: Out of memory (allocated 234881024) (tried to allocate 32 bytes) in /home1/admin/public_html/community/library/Zend/Db/Statement/Mysqli.php on line 294
 
Top Bottom