Show HN: A collection of useful regex patterns
projects.lukehaas.me
Show HN: A collection of useful regex patterns
1–5 of 5 posts
Re: Show HN: A collection of useful regex patterns
#2See [1] or [2] for some inspiration.
[1] https://news.ycombinator.com/item?id=12448844 [2] https://news.ycombinator.com/item?id=9089129
Re: Show HN: A collection of useful regex patterns
#3 #([a-fA-F0-9]{3}){1,2}\b
Neither of ours accepts 8 character Hex values (transparency in 7th and 8th characters).I have some more to share:
Match the 'src' for images
\]*[src] *= *[\"\']{0,1}([^\"\'\ >]*)
Match ID's for Youtube Videos
/http:\/\/(?:youtu\.be\/|(?:[a-z]{2,3}\.)?youtube\.com\/watch(?:\?|#\!)v=)([\w-]{11}).*/gi
Match CSS comments
\/\*[^*]*\*+([^/*][^*]*\*+)*\/
Match every word except words in list:
\bTarzan\b|\bJane\b|\bSuperman\b|(\w+);Re: Show HN: A collection of useful regex patterns
#4Your email regex doesn't accept some basic patterns, like foo+bar@foobar.com. Also, a lot of newer TLDs can be longer than 6 symbols, like ".clothing". See [1] or [2] for some inspiration. [1] https://news.ycombinator.com/item?id=12448844 [2] https://news.ycombinator.com/item?id=9089129
Re: Show HN: A collection of useful regex patterns
#5Your hex value does not accept uppercase values. Might I suggest this instead: #([a-fA-F0-9]{3}){1,2}\b Neither of ours accepts 8 character Hex values (transparency in 7th and 8th characters). I have some more to share: Match the 'src' for images \ ]*[src] *= *[\"\']{0,1}([^\"\'\ >]*) Match ID's for Youtube Videos /http:\/\/(?:youtu\.be\/|(?:[a-z]{2,3}\.)?youtube\.com\/watch(?:\?|#\!)v=)([\w-]{11}).*/gi Match CSS com…