Announcement

Collapse
No announcement yet.

regex for cleaner.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • regex for cleaner.php

    I am having a problem with the regular expression to use with cleaner.php in order to completely remove the following phpBB 2 BBcode while keeping the text between the tags:

    Code:
    [offtopic:522a0ada7e] text I want to keep [/offtopic:522a0ada7e]
    The numbers and letters inside the offtopic tags are ofcourse random.

  • #2
    This will wrap it in quote tags :

    PHP Code:
    $text preg_replace('#\[offtopic:([a-z0-9]+)\](.*)\[/offtopic:\\1\]#siU''[quote]$2[/quote]'$text); 
    This will remove the offtopic tags completely :

    PHP Code:
    $text preg_replace('#\[offtopic:([a-z0-9]+)\](.*)\[/offtopic:\\1\]#siU''$2'$text); 
    I wrote ImpEx.

    Blog | Me

    Comment


    • #3
      Thanks a lot I couldn't figure it out myself.. The '$2' was the issue in my case. It worked like a charm thanks again for your help !

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X