CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Substitution within tags, multiple times: Edit Log



dmittner
Novice

Jul 18, 2002, 3:14 PM


Views: 9983
Substitution within tags, multiple times

I'm working on modification to a BBS and I want to add code/code tags which stops the substitution of other tags within them. This is what I have so far:


Code
    while ( $$text =~ /\[code\].*?\[*?\[\/code\]/i || $$text =~ /\[code\].*?\].*?\[\/code\]/i ){    
$$text =~ s!\[code\](.*?)\[(.*?)\](.*?)\[/code\]!\[code\]$1\&\#091;$2\&\#093;$3\[/code\]!i
}



This seems to work fine if I only have one instance of the tags, but multiple ones cause everything between the very first open tag, and the very last close tag, to be ignored; including other open and close tags.

Suggestions?


(This post was edited by dmittner on Jul 18, 2002, 3:18 PM)


Edit Log:
Post edited by dmittner (Novice) on Jul 18, 2002, 3:16 PM
Post edited by dmittner (Novice) on Jul 18, 2002, 3:16 PM
Post edited by dmittner (Novice) on Jul 18, 2002, 3:18 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives