Ask a Question related to PERL Beginners, Design and Development.
-
Mark Maunder #1
regex question "match everything that does not include the string '<br>'
Hi,
I'm matching html using regex and use something like this to grab a
chunk of text up to the next html tag:
<font>([^<]+)</font>
But I'd like to say "match everything that does not include the string
<br>" rather than "match everything that does not include a "<"
character. Anyone got any suggestions?
Thanks,
Mark
Mark Maunder Guest
-
Can't find string terminator "EOM" - beginner question
Hello, I am a beginner in Perl programming. Currently, I am using Perl 5.005_03 in my Solaris 8 server. I am getting the following error... -
Can a regex match numbers?
Hello, please can you help me. Is it possible to specify number matching in a regex, i.e. can you have something like: my $match =~... -
RegEx to match names?
There are a few different name formats out there, and I'm having trouble incorporating them into one regex. e.g. George Walker Bush George W.... -
Regex to match ALL characters?
Hi All, I'm trying to parse an Apache httpd.conf file to read the 'Alias' sections using PHP. Take the one below for example. I have worked out... -
Need regex to match "^\n"
Hi: I am looking for a regex that will match a line with a single carrot: line = "^\n" However, the obvious does not seem to work: -
Jeff 'Japhy' Pinyan #2
Re: regex question "match everything that does not include the string '<br>'
On Jan 26, Mark Maunder said:
First, I don't suggest using regexes to parse HTML.>I'm matching html using regex and use something like this to grab a
>chunk of text up to the next html tag:
>
><font>([^<]+)</font>
>
>But I'd like to say "match everything that does not include the string
><br>" rather than "match everything that does not include a "<"
>character. Anyone got any suggestions?
What you want, though, is:
m{
<font>
( (?: [^<]+ | < (?!/font>) )* )
</font>
}
The middle part of that regex says "match either 'one or more non-<' or 'a
< that is not followed by /font' zero or more times".
--
Jeff "japhy" Pinyan [email]japhy@pobox.com[/email] [url]http://www.pobox.com/~japhy/[/url]
RPI Acacia brother #734 [url]http://www.perlmonks.org/[/url] [url]http://www.cpan.org/[/url]
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
Jeff 'Japhy' Pinyan Guest
-
Mark Maunder #3
Re: regex question "match everything that does not include the string '<br>'
Thanks Jeff, that helps. I use HTML::Parser for various tasks, but for
this particular one, I need exact matching, hence the regex.
On Mon, 2004-01-26 at 09:57, Jeff 'japhy' Pinyan wrote:--> On Jan 26, Mark Maunder said:
>>> >I'm matching html using regex and use something like this to grab a
> >chunk of text up to the next html tag:
> >
> ><font>([^<]+)</font>
> >
> >But I'd like to say "match everything that does not include the string
> ><br>" rather than "match everything that does not include a "<"
> >character. Anyone got any suggestions?
> First, I don't suggest using regexes to parse HTML.
>
> What you want, though, is:
>
> m{
> <font>
> ( (?: [^<]+ | < (?!/font>) )* )
> </font>
> }
>
> The middle part of that regex says "match either 'one or more non-<' or 'a
> < that is not followed by /font' zero or more times".
>
> --
> Jeff "japhy" Pinyan [email]japhy@pobox.com[/email] [url]http://www.pobox.com/~japhy/[/url]
> RPI Acacia brother #734 [url]http://www.perlmonks.org/[/url] [url]http://www.cpan.org/[/url]
> <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
> [ I'm looking for programming work. If you like my work, let me know. ]
Mark Maunder <mark@ziptree.com>
ZipTree.com
Mark Maunder Guest



Reply With Quote

