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

Re: Re: Re: Removing data from a string with Regex

by CharlesClarkson (Curate)
on Nov 15, 2001 at 23:01 UTC ( #125642=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Removing data from a string with Regex
in thread Removing data from a string with Regex

That regex would allow --from @something.com to pass and assign ' ' to $name. It would likely be better to use:/^--from\s*([^@\s]+)/ which fails for --from @something.com and could simplify the code further.

while ( <FILE> ) { print $1 if /^--from\s*([^@\s]+)/; } or: print $1 if /^--from\s*([^@\s]+)/ while <FILE>;



HTH,
Charles K. Clarkson


Comment on Re: Re: Re: Removing data from a string with Regex
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (18)
As of 2014-12-18 15:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (56 votes), past polls