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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC