in reply to Re^2: BBCodes, removing [URL's
in thread BBCodes, removing [URL's

What have you tried? From the documentation it doesn't seem too hard to add custom tags - did you manage that? If not, where did you fail?

Replies are listed 'Best First'.
Re^4: BBCodes, removing [URL's
by Anonymous Monk on Apr 24, 2009 at 10:52 UTC
    Ok,managed to sort it.

    my $test_string = q| [lien "dfgdgdg"][img]sdfsdfsdf[/img][/url] [lien "dfgdgdg33"][img]sdfsdfsdf[/img][/lien] Si qqn connait un transporteur ou une agence qui fais des bon prix [lien "http://www.smileycentral.com/?partner=ZSzeb001"][img]http://smi +leys.smileycentral.com/cat/12/12_1_220.gif[/img][/lien] pour l'australie je suis preneur merci............... BONNE ANNÉE [signature]|; $test_string =~ s/lien/url/sig; # the parser doesn't seem to like +this $test_string =~ s/\[url "([\?\%\:\/a-zA-Z0-9_\-\.=]+)"\]/[url=$1]/ +sig; while ($test_string =~ m%\[url=([\?\%\:\/a-zA-Z0-9_\-\.=]+)\]\[img +\]([\?\%\:\/a-zA-Z0-9_\-\.=]+)\[/img\]%gix) { print "FOO: $1 , and $2 \n"; }
    Seems to work fine:
    FOO: dfgdgdg , and sdfsdfsdf FOO: dfgdgdg33 , and sdfsdfsdf FOO: http://www.smileycentral.com/?partner=ZSzeb001 , and http://smile +ys.smileycentral.com/cat/12/12_1_220.gif


    Seems to be working ok atm - will do some more tests though.

    Weird thing though, is if I change the regex to:
    while ($test_string =~ m%\[lien \"([\?\%\:\/a-zA-Z0-9_\-\.=]+)\"\] +\[img\]([\?\%\:\/a-zA-Z0-9_\-\.=]+)\[/img\]\[/lien\]%gix) { print "FOO: $1 , and $2 \n"; }

    ..and get rid of the stuff that converts [lien "link"] to [url=whatever] .. it doesn't seem to work (no matches)

    Cheers

    Andy
Re^4: BBCodes, removing [URL's
by ultranerds (Hermit) on Apr 24, 2009 at 10:55 UTC
    UPDATE - never mind - sorted it:

    Thanks for the help guys.

    Cheers

    Andy