Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Help with RegEx

by furry_marmot (Pilgrim)
on Jul 01, 2010 at 21:58 UTC ( [id://847637]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $line_in = <<EOT;
    <?xml-stylesheet href="perl1.css" type="text/css"?>
    <link href="//www.perl.org/css/perl1.css" rel="stylesheet">
    <link href="/css/perl.css" rel="stylesheet">
    EOT
    
  2. or download this
    my @ss = $line_in =~ m{<(.*?)stylesheet(.*?)>}gis;
    
  3. or download this
      $1                         $2
    |----|          |--------------------------------|
    ...
                    $1                        $2
     |-----------------------------|          |
    <link href="/css/perl.css" rel="stylesheet">
    
  4. or download this
    my @ss = $line_in =~ m/(href="[^"]+")/gi;
    print "$_\n" for @ss;
    ...
    # href="perl1.css"
    # href="//www.perl.org/css/perl1.css"
    # href="/css/perl.css"
    
  5. or download this
    my @ss = $line_in =~ m/<(?=[^>]*stylesheet).*(href="[^">]+")/gis;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-23 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found