Escaping Multiple Single Quotes in Raw String Literal
Hey I noticed when trying to match a JMESPath expression that uses raw string literals with more than one escaped single quote, the matching fails. According to the proposal: https://jmespath.org/proposals/raw-string-literals.html :
"This proposal states that single quotes in a raw string literal must be escaped with a backslash."
And in the spec:
raw-string-escape = escape ("'" / escape)
When trying to match an expression with only one escaped single quote, it succeeds. If I add more than one, it fails to match but still compiles.
Example: JMESPath Expression: contains(['something\\''],a)
This returns true if a equals something'.
If I add an additional escaped single quote, matching fails.
Example: JMESPath Expression: contains(['some\\'thing\\''],a)
This should match if a equals some'thing' but does not.
@zaydu98
I’m not sure what shell or programming language you use, but the correct expression should only contain a single backslash character to escape a quote.
search( contains(['wanna be starting something'], a) , {"a": "wanna be starting something"} ) → truesearch( contains(['wanna be starting somethin\''], a) , {"a": "wanna be starting somethin'"} ) → truesearch( contains(['wanna be startin\' somethin\''], a) , {"a": "wanna be startin' somethin'"} ) → true
@zaydu98 you might want to use @jmespath-community/typescript.jmespath which is a fork of this library and already contains this fix.