if i place a forward slash in front of and exclamation mark will that escape the exclamation mark and make it readable to the regular expression?

preg_match("/Hello World\!/",$string);

Thanks in advance.

    For one, this: [/b] is a backslash, not a forward slash (or: /).

    For another, why are you asking us? Why not just try it yourself?

    (Also, to answer your question, there's no need to escape the exclamation point at that location since it would have no special meaning otherwise. Also note that you would technically need two backslashes to properly escape a character in a regexp pattern delimited by double quotes.)

      thanks for the simple reply..

      I was investigating on a .htaccess file and couldn't get it to 'cooperate', so i thought I'd ask the board.

      Apologies, on the slash post master!!

        Write a Reply...