Here's a typical regex string:
/^(?:[0-9]|[a-z]|[\._%\+-])+(?:@)(?:[0-9]|[a-z]|[\.-])+(?:\.)[a-z]{2,}$/i
Not easily readable, right? Here's where SRL (Simple Regex Language) wants to save you time. This tool uses more human-friendly syntax to generate the regex string for you. You can use their online generator, or install their tool for your site.
Here is one example of an SRL string, which is quicker to compute:
begin with any of (digit, letter, one of "._%+-") once or more,
literally "@",
any of (digit, letter, one of ".-") once or more,
literally ".",
letter at least 2 times,
must end, case insensitive
I haven't tried it out yet, but next time I need a regex I will!
No comments:
Post a Comment