note 53531 deleted from reference.pcre.pattern.syntax by colder
| From: | colder@php.net | Date: | Mon, 18 Jun 2007 17:59:55 +0000 |
| Subject: | note 53531 deleted from reference.pcre.pattern.syntax by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127560@lists.php.net to get a copy of this message | ||
Note Submitter: june05 at tilo-hauke dot de
----
//to match quotings in code strings by skipping included quotings if they appear use this
expression:
$matchQuotings='/(((?<!\\\)")((?<=\\\)"
|[^"])*((?<!\\\)"))
|(((?<!\\\)\')((?<=\\\)\'
|[^\'])*((?<!\\\)\'))
/';
// for example: matchQuotings finds:
// "javascript:func('string-param');"
// in strings like this:
// ... <a href="javascript:func('string-param')"> ...
// and finds:
// 'javascript:func("string-param");'
// in strings like this:
// ... <a href="javascript:func('string-param')"> ...
// and finds:
// 'a "b" c'
// "d 'e' f"
// in strings like this:
// ... x 'a "b" c' y "d 'e' f" z...