0

preg_match() will return

preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash

if the pattern is not well-formed. Is there a function to determine (TRUE or FALSE) if the pattern is well-formed before passing it preg_match()?

1

1 Answer 1

0
$match = preg_match('regex', 'string');

if ($match === false) {
    // failed
} elseif ($match == false) {
    // did not matched
} else {
    // matched
}

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.