Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Regex only returning partial data

by toolic (Bishop)
on Jun 06, 2008 at 17:42 UTC ( [id://690715]=note: print w/replies, xml ) Need Help??


in reply to Regex only returning partial data

If I escape the dash inside your character class, I get more:
$_ = '<title>GRP -134 - Grinding And Cutting Solution (ACME PR50 - Wat +er Type) </title>'; if (m/\s(?:-\s)?([\w\s\d()\-,]{1,75})<\/title>/) { print "$1\n"; }

prints:

-134 - Grinding And Cutting Solution (ACME PR50 - Water Type)

Update: Also, the \d is not necessary since you already use \w. You should also consider using one of the CPAN HTML parser modules to grab the contents of the <title> elements.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-16 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found