php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39857 Ereg(i) returns irrelevant result
Submitted: 2006-12-17 00:03 UTC Modified: 2006-12-18 00:37 UTC
From: adult at adult-inc dot biz Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 5.2.0 OS: Fedora core 5
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: adult at adult-inc dot biz
New email:
PHP Version: OS:

 

 [2006-12-17 00:03 UTC] adult at adult-inc dot biz
Description:
------------
Ereg and eregi functions returns irrelevant results

Reproduce code:
---------------
if (ereg("[9876543210]{2,6}", "2006-12-17"))
	echo "BUG";
else
	echo "OK";

Expected result:
----------------
OK

Actual result:
--------------
BUG

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-17 18:27 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

your regex allow for 2 numbers tom be matched. So it matches 
20 and returns TRUE indicating success.
 [2006-12-18 00:37 UTC] adult at adult-inc dot biz
Sorry, had a hard work that day :)
That's what i need: ereg("[^0-9$]{2,6}", "2006-12-17")
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon May 23 18:05:46 2022 UTC