Resource icon

Post Content Find / Replace 1.0.0

No permission to download

Hornstar

Well-known member
Quick Find:
Code:
ame

Regular expression:
Code:
#\[ame="http://(?:www.)?(youtube)[^=]+=([^"]+)"][a-z0-9\s-\[\]()]+\[/ame]#siu

Replacement String:
Code:
[media=\1]\2[/media]

Hi I just followed your advice:
upload_2014-4-27_17-45-31.png
This is a snippet of what it returned:
upload_2014-4-27_17-47-4.png

It looks like it may contain some invalid ones, and I am not sure if I should go ahead, but I did, and I got this error:
upload_2014-4-27_17-48-27.png
 

Arun Kumar

Member
I need help replacing with this

Code:
[video width=400 height=350]http://www.youtube.com/v/4fMY9GE6AIQ[/video]

to this

Code:
[MEDIA=youtube]4fMY9GE6AIQ[/MEDIA]

Thanks.
 

MattW

Well-known member
I need help replacing with this

Code:
[video width=400 height=350]http://www.youtube.com/v/4fMY9GE6AIQ[/video]

to this

Code:
[MEDIA=youtube]4fMY9GE6AIQ[/MEDIA]

Thanks.
upload_2014-5-3_17-12-17.png

RegEx:
Code:
#\[video width\=400 height\=350\]http://www.youtube.com/v/(.+)\[/video\]#siU
Replacement:
Code:
[MEDIA=youtube]\1[/MEDIA]
 

Arun Kumar

Member
Can you show a screen shot please? I tested it exactly as above, and it replaced the post
View attachment 73038
Yes, when i search it shows correctly when i run it. It shows the error.

here is the screen shot..

MEwWnXPw.png


9t9zQcvn.png


MCXg53yu.png
 

Jake Bunce

XenForo moderator
Staff member
@Arun Kumar

@MattW

The error usually means the resulting post is empty which is not allowed. But your replacement is not "empty". In looking at the code, this could also be the result of invalid BB code being stripped away at render time. It's probably the ampersand in your video id that is getting matched. Your regex needs to be tightened. Replace the (.+) with ([a-zA-Z0-9_\-]+)

The bottom of the screenshot shows a post with multiple matches. The UI for this addon puts the post link into a cell with a rowspan > 1 when there are multiple matches. It's not missing, it's just outside of the screenshot.
 

MattW

Well-known member
Thanks Jake, I didn't notice the lack of lines between the matches in the screen shot.
I was just using a quick and greedy regex in my example :(
 

Arun Kumar

Member
@Arun Kumar

@MattW

The error usually means the resulting post is empty which is not allowed. But your replacement is not "empty". In looking at the code, this could also be the result of invalid BB code being stripped away at render time. It's probably the ampersand in your video id that is getting matched. Your regex needs to be tightened. Replace the (.+) with ([a-zA-Z0-9_\-]+)

The bottom of the screenshot shows a post with multiple matches. The UI for this addon puts the post link into a cell with a rowspan > 1 when there are multiple matches. It's not missing, it's just outside of the screenshot.

Yay, that fixed it. (y)

Thank you for your help guys @MattW & @Jake Bunce
 

MITK

Member
Posting this again as i hope someone can make a suggestion

I have 45,000   and i would love to replacement with a space when i try it with the expression #\ # i get the following error:

Error
Please enter a valid message.

I there a way I can clean these up using the PCF tool?

I also tried \2 as the expression but still the same error.
 

Jake Bunce

XenForo moderator
Staff member
Posting this again as i hope someone can make a suggestion

I have 45,000   and i would love to replacement with a space when i try it with the expression #\ # i get the following error:

Error
Please enter a valid message.

I there a way I can clean these up using the PCF tool?

I also tried \2 as the expression but still the same error.

That error means an empty post resulted.

Use this query instead for such a simple replacement:

Code:
UPDATE xf_post
SET message = REPLACE(message, '&nbsp', ' ')
 

Parafal

Member
Hello,

I just migrated from VB4.2.1 to XF1.31. and I tried this addon to edit the youtube problem.

The youtube on my VB was for example:
Code:
[video=youtube;KiMbVAW2-CM]http://www.youtube.com/watch?v=KiMbVAW2-CM[/video]

I used the addon with the following information:

Quick find: [video
Regular expression: #\[video=youtube;([^\]]+)\]([^\[]+)\[/video\]#siU
Replacemente string:
Code:
[MEDIA=youtube]\1[/MEDIA]

Yes, this are the same information presented in the addon page. I have no idea what they mean, so I used them as is. I'm not an IT guy. :)

After using the addon it founds 7,935 videos that need to be changed.

However, when I checked the Save changes box, I get the error message: Please enter a valid message.

Any suggestion?

Thanks!
 

nguyenhuuhung

Active member
This addon is difficult for me to use
I want replace
[IMG']http://domain.com/media/albums/blend-photoshop.87/standalone?embedded=1[/IMG']

->>>>>>>>>> [photo="large"]87[/photo]

Can you help me??
 
Last edited:

Jake Bunce

XenForo moderator
Staff member
This addon is difficult for me to use
I want replace
[IMG']http://domain.com/media/albums/blend-photoshop.87/standalone?embedded=1[/IMG']

->>>>>>>>>> [photo="large"]87[/photo]

Can you help me??

Quick Find: [img]http://domain.com/media/albums

Regular Expression: #\[img\]http://domain.com/media/albums/[^\.\[]+\.([0-9]+)\[/img\]#siU

Replacement String: [photo="large"]\1[/photo]
 

Parafal

Member
Hello @Jake Bunce

Could you help me with my similar problem?

Hello,

I just migrated from VB4.2.1 to XF1.31. and I tried this addon to edit the youtube problem.

The youtube on my VB was for example:
Code:
[video=youtube;KiMbVAW2-CM]http://www.youtube.com/watch?v=KiMbVAW2-CM[/video]

I used the addon with the following information:

Quick find: [video
Regular expression: #\[video=youtube;([^\]]+)\]([^\[]+)\[/video\]#siU
Replacemente string:
Code:
[MEDIA=youtube]\1[/MEDIA]

Yes, this are the same information presented in the addon page. I have no idea what they mean, so I used them as is. I'm not an IT guy. :)

After using the addon it founds 7,935 videos that need to be changed.

However, when I checked the Save changes box, I get the error message: Please enter a valid message.

Any suggestion?

Thanks!
 

nguyenhuuhung

Active member
Quick Find: [img]http://domain.com/media/albums

Regular Expression: #\[img\]http://domain.com/media/albums/[^\.\[]+\.([0-9]+)\[/img\]#siU

Replacement String: [photo="large"]\1[/photo]
Thanks for your reply.But, it seems it does not work.
 
Last edited:
Top