Open almathaler opened 2 years ago
This is working as intended for Logos although it needs to be documented better. While Logos is using the syntax of Regex, it diverges in functionality: it's always greedy and it almost never backtracks.
For this specific use case you'd want r#""""[^"]*""""#
. If quotes are to be allowed internally it might be easier to implement this as a """
token with a callback that finds the closing """
.
I'll leave this open because .*
is a common enough use case were some special case in code generation could be done, because as of right now it will always consume all input till the end.
The regex
"\"\"\".*\"\"\"
cannot match "\"\"\"abc\"\"\"" in the following code snippet, though Rust's innate regex does match: