Resource icon

Post Content Find / Replace 1.0.0

No permission to download
What should be done to accomplish the following please?

  1. Attachment tags in the body of posts are now rewritten where possible to use the new XenForo data, so thumbnails etc. will now update transparently.
  2. Quote tags are now rewritten where possible to have proper user attribution and a link back to the quoted content.
 
Ok, next question. Do the post numbers match up? For example does post quoting 174795 match up correctly to the original 174795?
 
I did not have luck finding it, but another forum member here contributed a PHP script that cleans up the quote tags if you're coming from vB. The one I used was modified for some other issues we had in our posts (I modified it for further cleanup), so I would not want to post it here. The original is attached here somewhere though.

This was before the 1.0.1 release, where it has been fixed. Now if you are coming in from vB, the current importer should automatically fix those quotes for you.

For other cleanup, I just did it using SQL.

Code:
UPDATE mytable SET myfield = REPLACE(myfield,'old_text','new_text');
 
I'm having some trouble with this. Recently ported from IPB where the media tags were as follows:​

Code:
[media]http://www.youtube.com/watch?v=2LtBSqGzi3o[/media]

Here's my settings:
pOuLo.png

Tested the regex and it appears to work fine, but when I hit proceed nothing happens. All that happens is "Save Changes" becomes unchecked, like the tool is just refreshing the page.​

Any ideas / insight? I'd appreciate it greatly. Thanks.​
 
I have a bunch of youtube vids with &feature=related and such in the url. What what I add to search and convert them?

Thanks.
 
Negative, it doesn't match.
I'd suggest you search for
Code:
[quote=username;174795]
and replace it with
Code:
[quote=username]
in that case because if the numbers don't match up then the quote links would be completely wrong. You'll need to work out the exact regex strings yourself before committing it to the database.
 
Thought these Regular Express tools might help some people

http://gskinner.com/RegExr/
http://regexpal.com/
http://tools.netshiftmedia.com/regexlibrary/

paid
http://www.regexbuddy.com/

each have their own advantages and disadvantages

Regexpal is handy for color coding the expression to detect problems... try entrying:
(this)? [and]+ (that)*

and then "this and that" in the test data. Now take off the right bracket from [and] to see how it color codes the missing left bracket.


http://tools.netshiftmedia.com/regexlibrary/
Is useful because it's easy to compare two different test strings, and also had a nice library you can pop open.

Hope that helps someone!
 
i get this error on nearly every regex I create

Code:
preg_match_all() [function.preg-match-all]: No ending delimiter '^' found
  
expression entered: ^([A-Z][0-9]){3}$



any tips?
 
I can't figure out how to match this string, any regex experts on here?

Code:
<img src="http://www.whiterabbitpress.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />

I just want to replace the whole thing with this
Code:
;)
 
Don't know if anyone else has run into this before... but lets say you are coming from vb and had no limit on # of embeds in a post (like me). If you try to use this plugin to replace the old bbcode tags and you have a limit on embeds per post (mine was set at 5), it will complain if a post it's trying to convert exceeds that number of embeds and won't process any further.

The solution is, of course, to un-set the limit or raise the limit under the Messages options page.
 
I can't figure out how to match this string, any regex experts on here?
If the string is identical on every post then you should be able to do it with simple SQL query.

Code:
UPDATE xf_post SET message = REPLACE(message, '<img src="http://www.whiterabbitpress.com/forum/style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />', ';)');

Make sure you take a backup first.
 
Hoping I could get some help on these:

<iframe title="YouTube video player" width="640" height="390" src="http://www.youtube.com/embed/kvgox8IyPLs" frameborder="0" allowfullscreen></iframe>

AND

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/KRbKdx7TMio"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/KRbKdx7TMio" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

Obviously don't care about anything but the video id. Just want to replace these with media tag for YouTube.

I tried the code in this thread for the YouTube code that uses object tags:
http://xenforo.com/community/threads/post-content-find-replace.6548/page-3#post-152598

But on the conversion it only grabs the very first character of the video id.

Code:
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/MbJ7hPhyPz0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/MbJ7hPhyPz0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

Code:
[media=youtube]M[/media]
 
Here are the regex's I found to work for YouTube embeds.

Find:
Code:
#<object[^>]+>(<param[^>]+></param>)+<embed src="http://www.youtube.com/v/([A-Za-z0-9-_]++)[^"]+"[^>]+></embed></object>#siU
Replace:
Code:
[media=youtube]\2[/media]

Find:
Code:
#<iframe.+src="http://www.youtube.com/embed/([A-Za-z0-9-_]++)"[^>]+></iframe>#siU
Replace:
Code:
[media=youtube]\1[/media]
 
Break.com

Find:
Code:
#<object.+<embed src="http://embed.break.com/([A-Za-z0-9-_=]++).+</object>#siU
Replace:
Code:
[media=break]\1[/media]
 
For some reason, some of my youtube links show up as .

Is there a quick way to get rid of these unwanted double quotes straight after the videoid?
 
Top Bottom