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.*:.*/.
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[^:]*:.*/
|
---|
In Section
Seekers of Perl Wisdom