New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse Error. Cannot parse escaped dots. #173

Closed
TheSeamau5 opened this Issue Feb 15, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@TheSeamau5
Contributor

TheSeamau5 commented Feb 15, 2015

This code:

import Text (asText)

main = asText "\."

causes the following error:

Parse error at (line 4, column 19):
(line 1, column 3):
unexpected "."
expecting space, "&" or escape code

While this may seem like normal behavior for string, strings are also used to define regular expressions. So for example, a regular expression to parse emails is :

"[a-z0-9._+-]{1,20}@[a-z0-9]{3,15}\.[a-z]{2,4}"

and this string yields a parse error due to the escaped periord towards the end (cuz, you know, emails end in .com or .fr or something)

@TheSeamau5

This comment has been minimized.

Show comment
Hide comment
@TheSeamau5

TheSeamau5 Feb 15, 2015

Contributor

Sorry, I just saw the warning in the regex docs saying:

Be careful to escape backslashes properly! 
For example, "\w" is escaping the letter w which is probably not what you want. 
You probably want "\\w" instead, which escapes the backslash.
Contributor

TheSeamau5 commented Feb 15, 2015

Sorry, I just saw the warning in the regex docs saying:

Be careful to escape backslashes properly! 
For example, "\w" is escaping the letter w which is probably not what you want. 
You probably want "\\w" instead, which escapes the backslash.

@TheSeamau5 TheSeamau5 closed this Feb 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment