|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55179 Offer preg_match with array-support for pattern
Submitted: 2011-07-11 07:38 UTC Modified: -
Avg. Score:4.7 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: Assigned:
Status: Open Package: PCRE related
PHP Version: 5.3.6 OS:
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.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2011-07-11 07:38 UTC]
Maybe the existing preg_match could allow for an array to be given as $pattern. Or if not a preg_match_array() might be an alternative.

Idea is to check a string against a list of pattern. First matched pattern would return.

Test script:
  $patterns = array(

  $subject = "field.link2";

  if(preg_match($patterns, $subject)) {
    // ...

Expected result:
preg_match should find the first pattern that matches (if any).

Actual result:
No array-support for $pattern yet.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-12-24 08:58 UTC] arf2 dot njm at yahoo dot com
this informations are very useful for me
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Jan 21 03:01:23 2020 UTC