php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18714 preg_match requires double-escape for \ and /
Submitted: 2002-08-02 17:19 UTC Modified: 2002-08-02 19:03 UTC
From: dhoherd at actiontec dot com Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 4.2.2 OS: rh7.3 / win2kpro
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: dhoherd at actiontec dot com
New email:
PHP Version: OS:

 

 [2002-08-02 17:19 UTC] dhoherd at actiontec dot com
using preg match to search for \ or / requires you to double-escape the characters.

"/[\\\\\/]/" - works fine and mathches either \ or /.
"/[\\\/]/" - doesn't work, gives the error "Warning: Unknown modifier ']'"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-02 17:20 UTC] dhoherd at actiontec dot com
using preg_match(), and possibly others that i haven't tested, to search for \ or / requires you to double-escape the
characters.

"/[\\\\\/]/" - works fine and mathches either \ or /.
"/[\\\/]/" - doesn't work, gives the error "Warning: Unknown modifier
']'"
 [2002-08-02 19:03 UTC] sniper@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 09:01:24 2020 UTC