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

Re: string matching

by Paladin (Vicar)
on Jan 26, 2017 at 22:18 UTC ( #1180404=note: print w/replies, xml ) Need Help??


in reply to string matching

In a regex, * means to match 0 or more of the character right before it, so the regex /;FTP*:*/ means the following:
Match ;
Match F
Match T
Match 0 or more of P
Match 0 or more of :
;FTR :Foreign Tax Reclaim does indeed match ;FT followed by 0 P followed by 0 ;. If you mean to match 0 or more of any character, you want to use .*. So your regex becomes /;FTP.*:.*/.

Although to be more correct, you probably don't mean "match any amount of any character", you mean "match any amount of anything that isn't a :". Which would be /;FTP[^:]*:.*/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2023-12-07 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (32 votes). Check out past polls.

    Notices?