php - How to write regular expression for this kind of a string? -
i kind of string $_post array:
$string = "\"search text\""; or
$string = '\'search text\''; how check whether search text included in double quotes or single quotes using regular expression.
base on kolink answer did this
echo $subject = "'search text'"; $pattern = "/['\"](?=;$)/"; preg_match($pattern, $subject, $matches, preg_offset_capture, 3); print_r($matches); its not giving result. :(
so, clarify, user sending $string = "search text"; in textbox? or part of server-side code?
if it's first, can search /['"](?=;$)/ , tell if single or double quotes used.
if it's second, question makes no sense since quotes not part of string.
Comments
Post a Comment