php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10179 repetition quantifiers
Submitted: 2001-04-05 05:29 UTC Modified: 2001-08-06 13:14 UTC
From: teo at gecadsoftware dot com Assigned:
Status: Closed Package: PCRE related
PHP Version: 4.0.4pl1 OS: SuSE7.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: teo at gecadsoftware dot com
New email:
PHP Version: OS:

 

 [2001-04-05 05:29 UTC] teo at gecadsoftware dot com
I am not sure if it's a bug or misinterpretation on my side
but I expect something like  /[0-9]{,10}/ to match
a number at most 10 chars.

the following snipet reproduces the "problem", if any:

if (preg_match('/^[0-9]{,10}$/',3)) {
    echo "matched";
 } else {
    echo "not matched";
}
outputs "not matched".

And if I write {1,10} it matches. So the question is,
is the "minimum" quantifier mandatory?

ciao

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-06 13:14 UTC] andrei@php.net
{,10} means "match up to 10" which includes 0 matches.
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC