Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Retrieving specific word from a line of text.

by impossiblerobot (Deacon)
on Dec 11, 2002 at 16:48 UTC ( [id://219122]=note: print w/replies, xml ) Need Help??


in reply to Retrieving specific word from a line of text.

To answer your question, you need to use capturing parentheses. Additionally, the leading and trailing .*s are unnecessary.

m/PNODE:(\w+)/

The part of the regex matched within the parentheses will end up in $1. See perlre for more details.


Updated: Added link to perldocs, and decided to assume that he wanted an entire word, rather than a single word character.


Impossible Robot

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 04:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found