php - preg_match check if string is surrounded in double or single quotes -


can tell me regex see if surrounded in double or single quotes.

"this string" 

i want return false if quotes not present @ or not present @ start , end.

preg_match('/^(["\']).*\1$/m', $string);

will return 1 if string surrounded double quotes , 0 if not.


Comments

Popular posts from this blog

python - Why doesn't list have safe "get" method like dictionary? -

razor - Is this a bug in WebMatrix PageData? -

sql server - Stored procedure -