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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
RE question


New User

Jan 24, 2004, 9:27 AM

Post #1 of 6 (1630 views)
RE question Can't Post

I'm trying to match somthing globally in a string. What I need to do is match anything that starts with a ':' and ends with a '<br>'. It should not car about any thml tags that are in between. Right now I use:

$line =~ s/^(: [^<]*)/<span class=quote>$1<\/span>/;

This matches anything until it hits a '<'.

What I need is to match anything until it hits a '<br>'. I tried [^<br>] but I think that means match either <, or b, or r, or >.

How can I do this?


Thaumaturge / Moderator

Jan 24, 2004, 12:08 PM

Post #2 of 6 (1627 views)
Re: [wjbell2] RE question [In reply to] Can't Post

The regex that you need is


If you want to capture the text between ; and <br> then use parentheses


To match all occurances in a given string and capture them in an array, use something like this:

  my @matchs = $string =~ /;(.+?)<br/g;

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks

New User

Jan 24, 2004, 6:10 PM

Post #3 of 6 (1624 views)
Re: [davorg] RE question [In reply to] Can't Post

Thanks, it works. I tried that before and it didn't work (the obvious /: (.*)<br>)/ but I changed the way things are in the string in question and now it catches it. IIRC, I had to use the 'anything but' method before ([^<]).

This is for the forum software I've been working on. It's nothing real fancy but it has some pretty good features. Everyone's pretty helpful here and if anyone wants a copy feel free to email me at and I'll send you one after I update it with this code.

The forum's at:

Also check out my perl spam filter at:

(This post was edited by wjbell2 on Jan 24, 2004, 6:15 PM)


Jan 27, 2004, 9:13 AM

Post #4 of 6 (1616 views)
Re: [wjbell2] RE question [In reply to] Can't Post

Depending of course on the target market of your discussion board, it looks like you have a long way to go before you arrive at something similar to vbulletin or phpbb.

I took a quick look at the mail filter and there are some areas for improvement - there are also parts when you use error checking but fail to provide any usefull debugging details, such as:

open( ) || die;

New User

Jan 27, 2004, 2:10 PM

Post #5 of 6 (1609 views)
Re: [Recall] RE question [In reply to] Can't Post

Thanks for looking.

Well, I'm not trying to compete with vbulletin or phpbb. I just made a board for my needs and decided to pass it along here if anyone needed/wanted it.

Mail filter works really well... everything needs improvement.


Jan 28, 2004, 1:55 AM

Post #6 of 6 (1607 views)
Re: [wjbell2] RE question [In reply to] Can't Post

everything needs improvement

Apart from pepperoni pizza Wink


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

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