Skip to content

how to fix \: being treated as an unrecognized escape sequence? #820

Answered by BurntSushi
cn-kali-team asked this question in Q&A
Discussion options

You must be logged in to vote

So it's not quite clear what you're asking here. Here's the regex compilation error:

regex parse error:
    "name"\:"(.*?)"
          ^^
error: unrecognized escape sequence

Could you say what is confusing about this? It's saying that \: is an unrecognized escape sequence, and it is. That's correct. Are you trying to escape :? If so, why? : is not a regex meta character and doesn't require escaping.

Many regex engines permit escaping any character, even if it's not necessary or otherwise doesn't do anything. This regex engine is a bit more strict about such things. There are some open tickets for relaxing it somewhat, but just haven't gotten around to it yet. Although I'm not sure it woul…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cn-kali-team
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants