1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Post Content Find / Replace 1.0.0

Allows an administrator to do a regular expression find and replace in the content of all posts.

  1. tommydamic68

    tommydamic68 Well-Known Member

    I cant get my AME media to convert. Here is how my links appear.
    Code:
    [ame=http://www.youtube.com/watch?v=34cHfvYOYS0]The Politics of Litter - YouTube[/ame]
  2. dieg0

    dieg0 Member

    Hello,

    How would I go about removing both
    as well as
    ? I do not use them anymore and they mess up my posts.

    I have tried this so far

    Code:
    Quick Find: [spoiler
    Regular expression: #\[spoiler\]#siu
    
    But this is what I get if I check the Save changes option

    Code:
    Server Error
    
    Undefined index: match_146
    1.XenForo_Application::handlePhpError() in XenForo/Model/UserTagging.php at line 133
    2.XenForo_Model_UserTagging->_getTagMatchUsers() in XenForo/Model/UserTagging.php at line 16
    3.XenForo_Model_UserTagging->getTaggedUsersInMessage() in XenForo/DataWriter/DiscussionMessage/Post.php at line 70
    4.XenForo_DataWriter_DiscussionMessage_Post->_messagePreSave() in XenForo/DataWriter/DiscussionMessage.php at line 391
    5.XenForo_DataWriter_DiscussionMessage->_preSave() in XenForo/DataWriter.php at line 1434
    6.XenForo_DataWriter->preSave() in XenForo/DataWriter.php at line 1373
    7.XenForo_DataWriter->save() in PostReplace/ControllerAdmin/PostReplace.php at line 45
    8.PostReplace_ControllerAdmin_PostReplace->actionReplace() in XenForo/FrontController.php at line 337
    9.XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    10.XenForo_FrontController->run() in /usr/share/nginx/webs/xft/admin.php at line 13
    
    Can anyone help me out?
    Last edited: Sep 8, 2013
  3. tommydamic68

    tommydamic68 Well-Known Member

    Anyone?
  4. Ark Royal

    Ark Royal Member

    I am not sure what I am doing wrong, I have entered the following and when leaving the Save Changes box un-ticked I see nothing after running proceed and I think I should get a list of matches displayed.

    Any ideas, anyone?

  5. Andre Daub

    Andre Daub Member

    I have someting like this in many posts:

    [1]Fr 13’9 20:30 Hertha BSC – VfB Stuttgart

    ’ change to '
    – change to –

    I have the addon installed, but i don´t know how i have to do it. :sleep:

    Can you please help me?
  6. EQnoble

    EQnoble Equilux Nobiliterà


    Quick Find:
    Code:
    [ame
    Regular expression: edited
    Code:
    #\[ame.+youtube.+watch\?v=([^\]]+)\][^\[]+\[\/ame\]#siu
    
    Replacement String:
    Code:
    [media=youtube]\1[/media]

    _______________________________________________________


    Quick Find:
    Code:
    ’
    Regular expression:
    Code:
    #\&\#8217;#siu
    Replacement String:
    Code:
    '


    Quick Find:
    Code:
    –
    Regular expression:
    Code:
    #\&\#8211;#siu
    Replacement String:
    Code:

    ____________________________________________________________





    Please paste a full example from a post with that bbcode in it (view the post as an admin and click edit on it, copy that and paste it here in between code tags)
    Last edited: Sep 10, 2013
    Andre Daub likes this.
  7. Tom_

    Tom_ New Member

    Can someone help me to parse this links:

    Code:
    [video=youtube]http://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=related[/video]
    Code:
    [youtube]http://www.youtube.com/watch?v=dQw4w9WgXcQ[/youtube]
    Code:
    http://www.youtube.com/watch?v=dQw4w9WgXcQ
  8. Ark Royal

    Ark Royal Member

    I think the code in my post in the link below will do the job, my problem is I can't get the addon to do anything!

    Post Content Find / Replace
  9. EQnoble

    EQnoble Equilux Nobiliterà


    This should catch all of them

    Quick Find:
    Code:
    
    
    Regular expression:
    Code:
    #(?:\[youtube]|\[video=youtube])?http://(?:www\.)?youtube\.com\/watch\?v=([a-z0-9\-_]+)(?:[^\s[]+)?(?:\[\/youtube]|\[\/video])?#siu
    
    Replacement String:
    Code:
    [media=youtube]\1[/media]





    That will not help me help you though, I really need the exact content of the post, what you see when you click edit on a post, otherwise I have no clue why it would not be working or even where to start looking for errors.
    Tom_ likes this.
  10. Ark Royal

    Ark Royal Member

    Hi EQnoble,

    I have installed the add on and it appears to have been installed correctly as I can use it to enter the Quick find, Regular Expression and Replacement String. However, Nothing is displayed when I click on Process, even though I know I have posts with the strings in them.

    From reading the thread it appears that if you leave the Save Changes box un-ticked and click Proceed you should see a list of found occurences, I get nothing being found. Could it be a permissions issue?
  11. EQnoble

    EQnoble Equilux Nobiliterà

    I can not tell you that, like I said I would REALLY need you to click 'edit' on a post with one instance of the bbcode you are trying to change, if you think from my side of the problem here and flip it, it would be like me asking you if 86 is the answer to a math problem which i have not told you... you don't know if I am asking if 86 is the correct answer to 85 + 1 or if I am asking if 20+3 = 86, in essence without me giving you enough information you can not possibly know if you are giving good info in your answer to me. Back to reality, that is the same here with your problem but with bbcodes instead of math and switched positions.

    I can't and wont answer you until you can show me a post with the bbcode in it because we are dealing with regex and if I make an expression for you and it catches but is wrong...it will probably mess up your posts table.

    Again please click EDIT on a post containing the bbcode you want to replace and paste that code here in a code box otherwise I simply can not help you with any sort of value.
  12. Ark Royal

    Ark Royal Member

    I would like to convert the following

    Code:
    [youtube]http://www.youtube.com/watch?v=-SQLt-SUWOw[/youtube]
    I have tried the following but do not get any matches.


    Quick Find
    Code:
    [youtube
    Regular Expression
    Code:
    #\[(youtube):([a-z0-9_]+)\](.*)\[/\1:\2]#siU
    Replacement String
    Code:
    [\1]\3[/\1]
    Many Thanks
  13. EQnoble

    EQnoble Equilux Nobiliterà

    I can see why it is not working already.

    Ok before I get started, in that first block of code...is there anything following that in the post?


    [youtube][media=youtube]-SQLt-SUWOw[/media] , I see an odd youtube tag in front of the media but not after, did you cut that off or is this how all of your tags look now?
  14. Ark Royal

    Ark Royal Member

    Sorry mate you picked up my post as I was editing it!
    I forgot to use the code tags and the forum converted my link when I posted it.
    The following is what I have

    Code:
    [youtube]http://www.youtube.com/watch?v=-SQLt-SUWOw[/youtube]
    It is all ok now I have got the add on working now :whistle:
    Last edited: Sep 11, 2013
  15. EQnoble

    EQnoble Equilux Nobiliterà

    Ahhh ok that makes sense then :) lol


    Try this

    Quick Find:
    Code:
    [youtube
    Regular expression:
    Code:
    #\[youtube]http://(?:www\.)?youtube\.com\/watch\?v=([a-z0-9\-_]+)(?:[^\s[]+)?\[\/youtube]#siu
    
    Replacement String:
    Code:
    [media=youtube]\1[/media]
  16. dash

    dash New Member

    Hi,

    This has been a great tool and I have been able to correct the youtube and links on my site that transferred over from phpbb to Xenforo. However, the following youtu.be links were not converted.
    Code:
    [BBvideo 560,340:3pjz5b3f][media=youtube]at5jgYeBmqU[/media]
    and

    Code:
    [BBvideo 560,340:19v4pt66]http://youtu.be/Lzwm2ZW-FJE[/BBvideo]
    Does anyone know the proper expression to fix these links?

    Thank You
    Last edited: Sep 17, 2013
  17. EQnoble

    EQnoble Equilux Nobiliterà


    This one fixes the half fixed ones,

    Code:
    [BBvideo 560,340:3pjz5b3f][media=youtube]at5jgYeBmqU[/media]
    --------------


    Quick Find:
    Code:
    [bbvideo
    Regular expression:
    Code:
    #\[bbvideo\s[0-9]+,[^]]+]\[media=youtube]#siu
    
    Replacement String:
    Code:
    [media=youtube]

    ______________________________________


    This one catches the missed ones with youtu.be

    Code:
    [BBvideo 560,340:19v4pt66]http://youtu.be/Lzwm2ZW-FJE[/BBvideo]
    --------------


    Quick Find:
    Code:
    [bbvideo
    Regular expression:
    Code:
    #\[bbvideo\s[0-9]+,[^]]+]http://youtu[^/]+/([a-z0-9-_]+)\[/bbvideo]#siu
    
    Replacement String:
    Code:
    [media=youtube]\1[/media]
    dash likes this.
  18. dash

    dash New Member

    Thanks EQnoble!!! Those worked great.
  19. Dakis

    Dakis Well-Known Member

    I searched around but couldn't find this. I've succesfully removed other bbcodes but I'm having trouble with the COLOR bbcode. Now, I've removed everything that has alphabetic characters, for example [ color=RED ] (without the spaces obviously), but I don't know what the regular expression would be to remove the color tags that have hex numbers in them, for example:
    Code:
    [color=#003300]
  20. EQnoble

    EQnoble Equilux Nobiliterà

    Quick Find:
    Code:
    [color=
    Regular expression:
    Code:
    #\[color=\#[a-f0-9]+]#siu
    
    Replacement String:
    Code:
    
    
    Dakis likes this.

Share This Page