Getting warning whlie using preg_match....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashitpro
    Recognized Expert Contributor
    • Aug 2007
    • 542

    #1

    Getting warning whlie using preg_match....

    Hi everybody..

    The error I am getting is

    "Warning: preg_match() [function.preg-match]: Compilation failed: missing terminating ] "

    This happened because I'd supplied syntactically wrong regular expression to preg_match.
    This expression are to be supplied by user, so I don't have control over it.
    I just want to suppress this error. I don't want this warning on browser.
    I also tried using try catch block but no luck.

    any help?

    Regards,
    Ashish
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Try adding a @ in front of the function. That usually silences warnings like these.

    Comment

    • ashitpro
      Recognized Expert Contributor
      • Aug 2007
      • 542

      #3
      Originally posted by Atli
      Try adding a @ in front of the function. That usually silences warnings like these.

      Thanks...It's done...
      Thanks again...

      Comment

      Working...