4 ms·
don't worry, the htmls are ads pages where people deliberately put phone and email to contact to (public info) the correct regex can indeed produce noise, cons
by hs 18y ago
don't worry, the htmls are ads pages where people deliberately put phone and email to contact to (public info)
the correct regex can indeed produce noise, consider this string in an ads where the poster uses '+' to join info:
"please contact the owner, her info: 4041234567+owner@gmail.com ... thx!"
the correct 'boilerplate' regex will happily take 4041234567+owner@gmail.com ... which is not what i want; thus, noise
the less pedantic regex i use will just take owner@gmail.com, which is what i want
similarly with "?" char (legal for local part), the correct regex will catch "sendIM?owner@gmail.com"; which again, not what i want ...
the 'busted' regex will only take 'owner@gmail.com' ... which is what i want
that's the main reason the omissions of +,? and other legal chars in local part of my email regex, the second reason is speed
for email validation where what u get is just a string of less than 100 chars, it's fine to use complete email validation regex; however, for email scrapping of close to 1gb data, boilerplate won't cut it
i'm willing to sacrifice completeness for speed
my regex doesn't allow empty string, there's metachar '\s' for spaces, equivalent to [^ \t\n]
and i was wrong, '\w' is [^a-zA-Z0-9_] ... i forgot '^' and '_' are included in metachar '\w'
thx, your criticism forced me to reopen my regex book