I need help to understand why this happens :
I have a string in the form of "'{{item}}'"
(notice the single quotes inside double quotes).
So I wrote two regular expressions in order to remove single quotes and braces :
- This one does not capture the last character :
/{{|}}|'{{|}}'/g
(result is"item'"
) - This one does :
/'{{|}}'|{{|}}/g
(result is"item"
)
I tried to replace the single quote by a random character, but no matter, the last character is never captured in the first regex, while it is in the second. Why ?