develooper Front page | perl.beginners | Postings from March 2023

Re: A Regular Expression Problem in Perl 5.28

Thread Previous | Thread Next
Uri Guttman
March 28, 2023 20:29
Re: A Regular Expression Problem in Perl 5.28
Message ID:
On 3/28/23 16:17, Martin McCormick wrote:
> 	The string I am interested in testing for starts with 5
> or 6 digits in a row and all I need to do is determine that the
> first 5 or 6 characters are numbers Period.  That's all.
> my $regextest = '/^\d+\{5,\}/' ;

why are you escaping the {}?? those are meta chars that are needed to 
make that a 5+ range. just delete the backslashes on them and it will work.

you need to know when to backslash and when not too. all regex chars 
which do something are not backslashed. alpha chars with backslashes are 
regex char types and special chars.



A Long Strange Trip
A blog about computers, food, my life and silliness.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About