Quotes (escaped) inside "filtered" text or inside a filter's arguments
Example of trying to filter some text that has double escaped quotes inside of it:
{{ "let's try some \"quoted\" text" | my_filter }}
Example of trying to filter some text using an argument that has double escaped quotes inside of it:
{{ "text" | my_filter: "let's try some \"quoted\" argument" }}
These are scenarios that I have come across and it appears that the text and argument are both cut off at the first backslash \ because both 'QUOTED_STRING' => '"[^"]*"|\'[^\']*\'' and
'QUOTED_STRING_FILTER_ARGUMENT' => '"[^":]*"|\'[^\':]*\'', are greedy and stop after the first double quote " they find.
It seems that something like this might be a solution:
In \Liquid\Liquid change QUOTED_STRING and QUOTED_STRING_FILTER_ARGUMENT as follows:
'QUOTED_STRING' => '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'',
'QUOTED_STRING_FILTER_ARGUMENT' => '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'',
Thanks @bigwhoop for help on this.
That would be great.
Hi!
Could please make a pull request with tests for this?
Thanks!