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

Re: A Regular Expression Problem in Perl 5.28

Thread Previous | Thread Next
From:
Jim Gibson via beginners
Date:
March 29, 2023 14:09
Subject:
Re: A Regular Expression Problem in Perl 5.28
Message ID:
D3A7E157-57DB-4612-AD17-ED5CA5D402EE@icloud.com
On Mar 28, 2023, at 3:00 PM, Martin McCormick <martin.m@suddenlink.net> wrote:
> 
> Uri Guttman <uri@perlhunter.com> writes:
>> yes, but he kept the {5,} repeat count. so i just kept it too.
> 
> Now that I know how this works, I will probably change to
> {4,} as this would match 4 or more digits.  From reading the
> documentation, {4} means 4 and only 4.  {4,6} means 4 but nothing
> else except 6. {N,} means N as a low limit but any number higher.

\d{4,6} means match either 4, 5, or 6 successive number digits.

Here is the spec from perldoc perlretut:

    *   "a{n,m}" means: match at least "n" times, but not more than "m" times.


Jim Gibson
jim@gibson.org




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