Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Matching enclosed expression

by LazerRed (Pilgrim)
on Sep 14, 2003 at 23:43 UTC ( #291463=note: print w/ replies, xml ) Need Help??


in reply to Matching enclosed expression

While you will undoubtedly be reminded not to parse html with a regex... Here's something simple, and fragile :)

my $pattern = 'http://www.blah.com/cgi.pl?id=<blah>&blah'; my $matched =($pattern =~ /(\<\w+\>)/,$1); print "$matched";

<blah>
Whip me, Beat me, Make me use Y-ModemG.


Comment on Re: Matching enclosed expression
Select or Download Code
Replies are listed 'Best First'.
Re: Re: Matching enclosed expression
by shenme (Priest) on Sep 15, 2003 at 00:26 UTC
    Well, they _did_ ask for "<idparm>", but maybe they'll say oops they meant "idparm" ?   Let's throw 'em some additional pointers and say m/<([^>]*?)>/ will get what's inside the   '<'  '>'   pair.

    And yes, the "use CGI;  or die" crew hasn't weighed in yet.   (I'm a light-weight and don't count, but ...   Hey, why aren't you using CGI.pm?)

Re: Matching enclosed expression
by Abigail-II (Bishop) on Sep 15, 2003 at 07:13 UTC
    He was asking to parse a URL, so why would anyone remind him not to parse HTML with a regex?

    Abigail

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://291463]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2015-07-28 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls