I post this behavior. Maybe it is not a problem or maybe a solution can be found for this.
julia> "\U2200x\u2203y"
"∀x∃y"
julia> "\U2200f\u2203y"
"𢀏∃y"
I think it also would be nice to have the ability of including '\xff' characters in string literals.
Hence, I think the backslash might be used for delimiting the escape sequences as
julia> "\U2200\hello in between \u2203\escapes"
"∀hello in between ∃escapes"
julia> match(r"o\u17c\n", "Paweł Zadrożniak")
RegexMatch("ożn")
I list possible conflicts:
\u, \U, \0 - \9 and \x.\a, \b, \t, \n, \v, \f and \r\{, \+, and so on.Making Regex literal escapes as similar to our normal strings as possible is a good idea. I'm not sure what you're saying with the rest. The \U escapes expect a hex unicode sequence with up to eight hexadecimal characters; the \u escapes expect up to four. The \x escapes encode bytes, not characters – although for ASCII these coincide. Using \ to terminate an escape would actively be in conflict with other escapes since depending on what comes next, it could either terminate a sequence or start a new one. If you want to be sure about hex encodings of Unicode characters, you can use leading zeros to make sure that they have the maximum expected number of characters – four for \u and eight for \U.
I don't see this as a problem. To write U+2200 followed by f you just write \u2200f (u instead of U).
I see now. Thanks! As @JeffBezanson said, it is no longer a problem... Maybe I was confused by the docs. Now that I know that I could use leading zeros, it is clear to me.
What about making Regex literals similar to string literals? Shall I open a new issue an close this?
What about making Regex literals similar to string literals? Shall I open a new issue an close this?
Yes, probably better than mixing the two issues.
Most helpful comment
I don't see this as a problem. To write U+2200 followed by
fyou just write\u2200f(uinstead ofU).