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

Re: A Regular Expression Problem in Perl 5.28

Thread Previous | Thread Next
From:
Uri Guttman
Date:
March 28, 2023 20:29
Subject:
Re: A Regular Expression Problem in Perl 5.28
Message ID:
05fa29a7-bdc2-9740-7ba1-8ab5203dd734@perlhunter.com
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.

thanx,

uri


-- 
https://uriguttman.blogspot.com/
A Long Strange Trip
A blog about computers, food, my life and silliness.


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About