Resource icon

Post Content Find / Replace 1.0.0

No permission to download
After importing from smf, all my old quotes look like this:

[quote author=liloleman link=topic=45883.msg155275#msg159275 date=1359910405]

Can someone tell me what replacement string would work for replacing this with [ quote="username" ]

TIA
Going to bed this moment, but have a question, after importing from smf did the smf message # being msg155275 import as the same message in xenforo. If not that's fine, but if it did I can add the message in the expression.
 
Last edited:
Going to be red this moment, but have a question, after importing from smf did the smf message # being msg155275 import as the same message in xenforo. If not that's fine, but if it did I can add the message in the expression.

No, it did not import as the same message. Thank you!
 
Ok but you should know that if you do this this way, any links in posts that are not to your own forum but follow that same scheme will be broken.

Realistically to do this right I would need a full link including your forum's domain.

If you are absolutely positive that no other links in your forum go to a vb based forum outside of your own than I can give you an expression that will work as you asked, otherwise I will need to capture more than just the part you posted.
that is Query helped me:
Code:
UPDATE xf_post SET message = replace(message,"www.mysite.com/forum/showthread.php?t=","www.mysite.com/forum/index.php?threads/");
Thank you
alkahf
 
Last edited:
No, it did not import as the same message. Thank you!
Just woke up here, sorry had a long day yesterday.


Wait a sec don't use it yet...just realized it wont capture nested quotes...let me get some coffee and then i will edit this post and tag you

@imno007 Ok so I blame not being fully awake but I made the expression more complex than it needed to be...this will work

*edited
Code:
Quick Find:            [quote author
Regular expression:    #\[quote\sauthor=([a-z0-9\s]+)\slink[^\]]+]#siu
Replacement String:    [quote="\1"]

Let me know how this works out for you.
 
Last edited:
I'm working on a conversion from ipb 1.3 -> Xenforo (passing through phpBB in the middle). However, a lot of my bbcode has turned into html through the process. So, I'm seeing things like this all throughout the posts:

<div align="center">Centered Text</div>

<div align="justify">Justifed text</div>

<span style='color:Mediumpurple'>Purple Text</span>

<span style='color:Mediumpurple'><span style='font-size:21pt;line-height:100%'><span style='font-family:Optima'>Header</span></span></span>

I'd like to turn however much I can back into bbcode, though I know nothing about expressions. Would somebody be able to give me a hand?
 
hello
i think my Query in this post #267 will help you to replace any thing in post message.
For example put this to replace <div align="center"> with [CENTER ] by this Query throw phpMyAdmin > SQL:
Code:
UPDATE xf_post SET message = replace(message,"<div align="center">","[center]");
 
Hm, would there be a way to also get the appropriate closing tags? i.e., the closing alignment tags are just </div> right now. But they could be /left, /right, or /center if they get converted properly.

Also, is there a way to handle the html -> bbcode with variables in it? Like the font sizes and colors? There's no set list of colors that are used on my old forum, so those could be anything.
 
I'm working on a conversion from ipb 1.3 -> Xenforo (passing through phpBB in the middle). However, a lot of my bbcode has turned into html through the process. So, I'm seeing things like this all throughout the posts:

I'd like to turn however much I can back into bbcode, though I know nothing about expressions. Would somebody be able to give me a hand?

I cannot see all the different possibilities that should be caught but try testing this and let me know what you get , I can't test everything 100% because I cannot guess at all the possibilities that I would come across having had a copy of such a conversion myself, as of now I am working with just a few examples provided that do not reflect every possibility.

If you do feel like testing this on a testbed...
be sure to have a backup and be working from that backup and ABSOLUTELY NOT be doing this on a live site


This will also replace any tags inside code blocks that match, if you can live with that these should work for you.
Quick Find: <span
Regular expression: #\<span\sstyle\=\'font\-family\:([a-z0-9-]+)\'\>#siu
Replacement String: [FONT=\1]

Quick Find: <span
Regular expression: #\<span\sstyle\=\'color\:([a-z0-9-\#]+)\'\>#siu
Replacement String: [COLOR=\1]



_____________________
Use this last to clean up empty closing spans after you have replaced all spans

Quick Find: </span
Regular expression: #\<\/span\>#siu
Replacement String:
 
Last edited:
Thanks! But when I tried that, I got this error.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 26506 bytes) in \library\Zend\Db\Statement\Mysqli.php on line 276

Probably because I do have over 76000 posts this would be going through.
 
Need help converting these BBCodes to XF

[BBvideo 600,300:12rwum1k]https://www.youtube.com/watch?v=AkNQom3EPTc[/BBvideo]
to
[media=youtube]

viewtopic.php?f=8&t=2377
to
threads/2377


Remove these BBCodes from content

[glow=Red]
[highlight=#ffffff]
 
Last edited:
to replace: [BBvideo 600,300:12rwum1k].+[/BBvideo] with xf's media tag for youtube

Quick Find: [BBvideo
Regular expression: #\[bbvideo\s[a-z0-9,:]+\][^\=]+\=([^\[]+)\[\/bbvideo]#siu
Replacement String: [media=youtube]\1[/media]

----------------------------------------------------------

To make your thread links relevant (you need to customize this to only effect links to your site...please contact me privately for that)

Quick Find: viewtopic.php
Regular expression: #viewtopic\.php\?f\=[0-9]+\&t\=([0-9]+)#siu
Replacement String: threads/\1

----------------------------------------------------------

To remove the opening glow tag
Quick Find: [glow
Regular expression: #\[glow\=([a-z0-9\#]+)\]#siu
Replacement String:

----------------------------------------------------------

To remove the opening highlight tag
Quick Find: [highlight=
Regular expression: #\[highlight\=([a-z0-9\\\#]+)\]#siu
Replacement String:

----------------------------------------------------------

To remove the closing glow tag
Quick Find: [/glow
Regular expression: #\[\/glow\]#siu
Replacement String:

----------------------------------------------------------

To remove the closing tag
Quick Find: [/highlight
Regular expression: #\[\/highlight\]#siu
Replacement String:
 
Last edited:
All the Regex worked brilliant. Thank you so much

Issue with URL Regex.URL seems to have converted to

threads/2384#p8101

but in XF its

threads/2384/#post-8101


Can we also convert it for attachments

Phpbb file attachment URL is

download/file.php?id=8

to XF

attachments/name-fileextension.8/
 
For phpbb users some simple URL parameters.


Quick Find : &p=
Regex : #\&p\=([0-9]+)#siu
Replacement :

Quick Find : &start=
Regex : #\&start\=([0-9]+)#siu
Replacement :

Quick Find : [twitbox]
Regex : #\[twitbox].+\[\/twitbox]#siu
Replacement :

Quick Find : download/file.php?id=
Regex : #download\/file\.php\?id\=([0-9]+)#siu
Replacement : attachments/\1

Will update this thread with more info
 
Last edited:
All the Regex worked brilliant. Thank you so much

Issue with URL Regex.URL seems to have converted to

threads/2384#p8101

but in XF its

threads/2384/#post-8101


Can we also convert it for attachments

Phpbb file attachment URL is

download/file.php?id=8

to XF

attachments/name-fileextension.8/
can you give me full links please...it is hard to guess what the rest of the link looks like for forum software I don't use and I really need full links to do this. You can convo me those if you like...

Also are you looking for a fix to the regex for the urls , or are you just testing now and looking to have the expression fixed so that it catches it on the first shot?
 
can you give me full links please...it is hard to guess what the rest of the link looks like for forum software I don't use and I really need full links to do this. You can convo me those if you like...

Also are you looking for a fix to the regex for the urls , or are you just testing now and looking to have the expression fixed so that it catches it on the first shot?

I got the hang of it now with your help. The regular regex which I use in Javascript wasn't working now that you have shown me examples got the delimiters I was looking for.

Even I am not sure of all the URL parameters used in Phpbb. I am seeing the Google webmasters tools URL parameters tools and updating it one by one.

I am testing it not working on live site. I will update this thread with what I find. I will PM the URL's.
 
ok so I think I may have a way to make this work though not sure...still playing with some stuff and the only way I know I can do this currently is to actually modify this addon.

And a question...

Does the bold part in: 'viewtopic.php?f=69&t=691165&start=15#p3865565' refer to - 'open the page starting at post 15 in that particular thread' which supposes that your forum shows 15 posts a page currently?
 
Does the bold part in: 'viewtopic.php?f=69&t=691165&start=15#p3865565' refer to - 'open the page starting at post 15 in that particular thread' which supposes that your forum shows 15 posts a page currently?
Yes that is correct. That number varies depending on number of posts per page.

If you have set number of posts to 15 per page.
Page 3 will be 'viewtopic.php?f=69&t=691165&start=30#p3865565' Page 4 'viewtopic.php?f=69&t=691165&start=45#p3865565'
 
Back
Top Bottom