Open distravantari opened 7 years ago
I just trace it and I found that this line is actually the one who removes the "."
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.
@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.
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
the "@" is working fine but it still remove the "." .