Skip to content
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

can't really capture a user's e-mail #31

Open
distravantari opened this issue Aug 25, 2017 · 4 comments
Open

can't really capture a user's e-mail #31

distravantari opened this issue Aug 25, 2017 · 4 comments

Comments

@distravantari
Copy link

distravantari commented Aug 25, 2017

the "@" is working fine but it still remove the "." .

@distravantari
Copy link
Author

I just trace it and I found that this line is actually the one who removes the "."

msg = rs.UnicodePunctuation.ReplaceAllString(msg, "")

@kirsle
Copy link
Member

kirsle commented Aug 25, 2017

Yeah I was aware of the Unicode punctuation getting in the way of that, but I just thought of a way I might work around it:

Don't remove punctuation if it has letters on either side of it. So a normal period in a sentence would be removed because one side has a space on it, but a string like "some.com" with a dot touching letters would be left alone.

I played with it a bit here but the regexp still isn't quite right: https://play.golang.org/p/PFujU2kE0Q

At first I was trying to use a lookbehind regexp like (?<![A-Za-z0-9])[.,:?!](?![A-Za-z0-9] but Go doesn't support those, so something that just captures the characters on either side and returns them ($1$2) would probably be the way to go.

@meowgorithm
Copy link
Contributor

meowgorithm commented Sep 13, 2017

@distravantari for what it's worth, I’ve been needing to capture user input exactly as the user sent (emails, street addresses and so forth) and have been doing so by putting the raw input into a uservar and then pulling it out in a macro. See #34.

@ghost
Copy link

ghost commented Aug 24, 2023

maybe instead of using *regexp as UnicodePunctuation having a function in place because Go dont support lookbehind regexp
default will be still the current regexp wrapped in a function

i was running into similar problems with catching IPv4/IPv6 and Domains

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

No branches or pull requests

3 participants