RegExpBuilder – Create regular expressions using chained methods
1–10 of 56 posts
Re: RegExpBuilder – Create regular expressions using chained methods
#2``` (?xi) \b ( # Capture 1: entire matched URL (?: [a-z][\w-]+: # URL protocol and colon (?: /{1,3} # 1-3 slashes | # or [a-z0-9%] # Single letter or digit or '%' # (Trying not to match e.g. "URI::Escape") ) | # or www\d{0,3}[.] # "www.", "www1.", "www2." … "www999." | # or [a-z0-9.\-]+[.][a-z]{2,4}/ # looks like domain name followed by a slash ) (?: # One or more: [^\s()]+ # Run of non-space, non-() | # or \(([^\s()]+|(\([^\s()]+\)))\) # balanced parens, up to 2 levels )+ (?: # End with: \(([^\s()]+|(\([^\s()]+\)))\) # balanced parens, up to 2 levels | # or [^\s`!()\[\]{};:'".,?«»“”‘’] # not a space or one of these punct chars ) ) ```
Re: RegExpBuilder – Create regular expressions using chained methods
#3Thanks, this is a lot better than writing this (even if the formatting worked here): ``` (?xi) \b ( # Capture 1: entire matched URL (?: [a-z][\w-]+: # URL protocol and colon (?: /{1,3} # 1-3 slashes | # or [a-z0-9%] # Single letter or digit or '%' # (Trying not to match e.g. "URI::Escape") ) | # or www\d{0,3}[.] # "www.", "www1.", "www2." … "www999." | # or [a-z0-9.\-]+[.][a-z]{2,4}/ # looks like domain name followed…
Re: RegExpBuilder – Create regular expressions using chained methods
#4Re: RegExpBuilder – Create regular expressions using chained methods
#5Re: RegExpBuilder – Create regular expressions using chained methods
#6Re: RegExpBuilder – Create regular expressions using chained methods
#7Re: RegExpBuilder – Create regular expressions using chained methods
#8I've "learned" regular expressions multiple times but it just never sticks, I have no idea why. It certainly doesn't help that there are several different incompatible syntaxes (so what I remember and think "should" work doesn't).
I'd prefer to write RegX's in this style, however I would pay attention to performance (not that Regular Expressions are high performance, however I wouldn't want to see a large performance loss either).
Re: RegExpBuilder – Create regular expressions using chained methods
#9Thanks, this is a lot better than writing this (even if the formatting worked here): ``` (?xi) \b ( # Capture 1: entire matched URL (?: [a-z][\w-]+: # URL protocol and colon (?: /{1,3} # 1-3 slashes | # or [a-z0-9%] # Single letter or digit or '%' # (Trying not to match e.g. "URI::Escape") ) | # or www\d{0,3}[.] # "www.", "www1.", "www2." … "www999." | # or [a-z0-9.\-]+[.][a-z]{2,4}/ # looks like domain name followed…
HN doesn't support Markdown. You'll need to prefix each line with >= 2 spaces for it to be treated as code. https://news.ycombinator.com/formatdoc
Re: RegExpBuilder – Create regular expressions using chained methods
#10These web based tools can do it: