• Yeah, anyway, the point is that one should add 4 backslashes in code for every backslash you want matched…

    And, personally, when I want to match 2 characters, like aa, I usually write /aa/ instead of /a{2}/. That’s how I roll 😉

  • but it’s still ugly.

  • In .NET, the solution is to use a special string syntax that accepts any character, including new lines, and that only escapes quotes with double quote characters. Instead of “\t” use @”t” which is perfect for Regex and things like embedded scripts that contain newlines and would be ugly with rn in them. As far as I remember there is no alternative syntax for strings in PHP, but it sure seems like a useful construct to me.

  • chintan

    I want to replace three backslashes with null character.
    But using 12 backslashes , it is not working
    Example :

    1. \ replace with null
    2. \\ replace with

  • Try it like this:

Advertisment ad adsense adlogger