I have a string:
This is a text, \"Your Balance left $0.10\", End 0
How can I extract the string in between the double quotes an
For everyone hunting for a full featured string parser, try this:
(?:(?:"(?:\\"|[^"])+")|(?:'(?:\\'|[^'])+'));
Use in preg_match:
$haystack = "something else before 'Lars\' Teststring in quotes' something else after";
preg_match("/(?:(?:\"(?:\\\\\"|[^\"])+\")|(?:'(?:\\\'|[^'])+'))/is",$haystack,$match);
Returns:
Array
(
[0] => 'Lars\' Teststring in quotes'
)
This works with single and double quoted string fragments.