Skip to content

Added the ability to pass in a regEx string.#8

Open
tkeithblack wants to merge 9 commits intosamuelezedi:masterfrom
tkeithblack:master
Open

Added the ability to pass in a regEx string.#8
tkeithblack wants to merge 9 commits intosamuelezedi:masterfrom
tkeithblack:master

Conversation

@tkeithblack
Copy link
Copy Markdown
Contributor

Allow passing a custom regEx string to override the built-in regex used to detect urls and emails.

…regEx string used to detect emails and urls.
The previous regex string would flag numbers like 60.99 as a url, and it would flag any word with a dot like good.bye or anything with two dots like hello..there as urls.

This new version does not flag these false positives, however, it will only catch emails and urls with the following extensions.

.com
.ru
.org
.gov
.net
.ir
.in
.uk
.au
.de
.ua
.edu
.io
.co
@tkeithblack
Copy link
Copy Markdown
Contributor Author

Added to this push request an updated regEx string for detecting urls and email addresses. This was tested on the following text and correctly flags all valid emails.

I have tested it successfully against the string:

"This paragraph is testing embedded urls like www.example.io
and example.com and https://randomweb.io or maybe http://website.co
or maybe even api.website.com as well as email addresses like
tomtom@phonelynk.io or bubba@email.co or goofball@bobo.com or website.gov
or somesite.org or university.edu but not something like
goofball@bobo since that has no .com on it also, it should not be fooled
by double dots like thank..you, or even single dots like love.you
That is one that gave me a really hard..time dude!!! I mean, really.
And finally, it should not be fooled by numbers like 200.12
That has been tough to fix :("

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant