Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Problem with <> and regex

by kcott (Archbishop)
on Mar 11, 2014 at 23:21 UTC ( [id://1077932]=note: print w/replies, xml ) Need Help??


in reply to *fixed*Problem with <> and regex

G'day luxlunae,

This matches your requirements :-)

#!/usr/bin/env perl -l use strict; use warnings; my $html = '<span class="author-name" itemprop="author">Romaxton</span +>'; my $re = qr{<[^>]+>([^<]*)<[^>]+>}; print "The idea is to reduce:\n", $html; $html =~ s/$re/$1/; print "to\n", $html;

Output:

The idea is to reduce: <span class="author-name" itemprop="author">Romaxton</span> to Romaxton

-- Ken

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-26 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found