Created
July 22, 2010 14:26
-
-
Save chluehr/486036 to your computer and use it in GitHub Desktop.
RegExp: Detect single/quoted string (w/ escapes) within strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// detect single/quoted string (w/ escapes) within strings ..: | |
$regexp = '/(["\\\'])(?:\\\\?+.)*?\1/'; | |
$testStr = " foo \"b\\\"ar\" baz '0\"8\"15' bing"; | |
preg_match_all($regexp,$testStr,$matches); | |
print_r($matches); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment