Article 50TJD Seeking interesting regex samples

Seeking interesting regex samples

by
Turbocapitalist
from LinuxQuestions.org on (#50TJD)
I am looking to collect a samples of interesting or particularly useful regular expressions. POSIX, Extendend, or PCRE are all good. I've seen RexEgg, Ryan's Tutorial's Regular Expressions!, and the Regular Expressions Tutorial to name three. I've also cruised through a bit of code but the syntax is not something that can easily be found genericly with grep. So I am asking for what you recall:

Which interesting and/or useful patterns have you seen, made, and/or used?

Myself, I have recently dealt with this one to place commas in a rather long number:

Code:s/(\d)(?=(\d{3})+$)/$1,/g;Strip leading and trailing white space:

Code:s/^\s+//; s/\s+$//;Strip hidden Unicode word joiner:

Code:s/\x{2060}//g;However, it has not occured to me to keep note of them over the years and most have been one-offs. It would be interesting to know which regular expressions have been particularly useful or interesting, especially the longer, more complex ones.latest?d=yIl2AUoC8zA latest?i=JmkiAKy8o4o:mG5FTRUlaYs:F7zBnMy latest?i=JmkiAKy8o4o:mG5FTRUlaYs:V_sGLiP latest?d=qj6IDK7rITs latest?i=JmkiAKy8o4o:mG5FTRUlaYs:gIN9vFwJmkiAKy8o4o
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments