![]() Topic awaiting preservation: Your favorite RegEx (Page 1 of 1) |
|
---|---|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
![]() I am looking for a listing of everyones favorite regular expression and a breif description of why. I am going to be adding all your replies to a tutorial I am writing for the GN. So, if you don't want your username, regex and explaination included don't post. That makes things simple. I am going to start it off. |
Bipolar (III) Inmate From: Brisbane |
![]() Woohoo, someone's finally writing a regex tutorial for the GN. I think I stuck my hand up to do one of them years ago but never got around to it. Although, I'm a little unsure about that regex. That doesn't match country based domains like .com.au does it? (I just woke up so I could be wrong)... |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() I don't have a favorite regex per se but one simple trick is for matching stuff inbetween two delimeters |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
![]() Nice one! I like that, and it can be adapted for many other purposes. |
Maniac (V) Mad Scientist From: :morF |
![]() I use asylum style BBCode in almost any CMS style system I make, so my favourite regex has to be the one that allows me to hand [url= style tags code: (?Ui)(\[url=)(.*)(\])(.*)(\[\/url\])
|
Bipolar (III) Inmate From: Victoria, BC |
![]() My favourite regex would have to be this one that matches and remembers chunks of any valid URL: code: ^((\w*):\/\/)?([^\/]*)\/?(.*)?$
|
Maniac (V) Mad Scientist From: Rochester, New York, USA |
![]() That is useful too! The reason I wanted this thread above and beyond the use in the tutorial, is that everyone who uses them has one, and they can all be totally different. Many people use things daily that I wouldn't think of using at all. The other thing is that regular expressions can vary so much from person to person. Even things that do the same things can be extremely different. |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
![]() Abb! I totally missed you regex, you must have posted it while I was posting my response. That is a great regex! Thanks for sharing! |
Maniac (V) Inmate From: out of a sleepy funk |
![]() sorry to go OT a bit but I found this several weks ago, have yet to use it but thought it may be of interest and use to anyone checking this thread for cool stuff (hopefully a good piece of tutorware) |
Paranoid (IV) Inmate From: A graveyard of dreams |
![]() I often use both the * and the ? to find the files I want, for example *.pdf or chapter1?.pdf. But the one I probably use the most - while editing files in Vim - is the simple /something or /\>anotherthing\>to find every occurance of "something" or the word "anotherthing". code: s/(?<=\d)(?=(\d\d\d)+(?!\d))/,/g
|
Paranoid (IV) Inmate From: France |
![]() I'm surprised nobody already talked about that Shakespearian RegEx : |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]()
|
Paranoid (IV) Inmate From: Madison, Indiana, USA |
![]() I don't know if I have a favorite. I use regular expressions a lot and have used the following several times recently: |