June 1st 2008 - National Regular Expression Day! (Post A Comment, Win A Prize)

Posted May 28, 2008 at 10:01 AM

NOTE: To win prizes, you must post a comment below (and mention which prize you would be interested in).

Not so long ago, I was walking down 14th street in New York City when out of no where, I started to think about Regular Expressions. They are just so awesome. I actually took a moment out of my walk home to stop and think about how much they have made my life better. That might seem like a silly notion to those who have not yet used regular expressions, but I think, to those of you who have used them, this feeling might not be so foreign. Everyday might be a bit of a stretch, but I certainly use regular expression every single week in my work; and, I'm finding new ways to leverage regular expressions all the time.

Regular Expressions are so awesome that I wanted to find a way to really give them their moment in the sun. And so, I am hereby announcing the first ever National Regular Expression Day on Sunday, June 1st, 2008. I'd like this to be a day where people take some time to reflect on how useful regular expressions are. And, if you haven't yet used regular expressions, this would be a great day to maybe set aside some time and finally see what all the hubbub is about.


 
 
 

 
National Regular Expression Day - June 1st, 2008 - Brought To You By Ben Nadel & Kinky Solutions  
 
 
 

And, what national holiday would be complete without some cool prizes and give-aways? To be honest, originally, I wanted to do something cool where people got to flex their Regular Expression muscles, but I have been way too busy lately to really devote a lot of brain power to that. So, as an easy way to enter the give aways, all you have to do is post a comment below (before June 2nd) on how much you like regular expressions and what prize you would be interested in winning. Winners will be selected Monday, June 2nd, 2008. And, what can you win, you ask? Some of the following regular expression related goodies:

1) Shakespeare RegEx Shirt


 
 
 

 
National Regular Expression Day - 2008 - Shakespeare TShirt  
 
 
 

2) xkcd RegEx Shirt


 
 
 

 
National Regular Expression Day - 2008 - XKCD TShirt  
 
 
 

3) RegexBuddy License


 
 
 

 
National Regular Expression Day - 2008 - RegexBuddy License  
 
 
 

4) Mastering Regular Expressions


 
 
 

 
National Regular Expression Day - 2008 - Mastering Regular Expressions  
 
 
 

5) Sams Teach Yourself Regular Expressions in 10 Minutes


 
 
 

 
National Regular Expression Day - 2008 - Sams Teach Yourself Regular Expressions In 10 Minutes  
 
 
 

Good luck, and I hope this is fun for people. And remember, win or lose, if you use Regular Expressions, you are always a winner :)

Post Comment  |  Ask Ben  |  Permalink  |  Print Page





Reader Comments

May 28, 2008 at 10:24 AM // reply »
34 Comments

Hey, Ben,

Not to throw a wrench into things, but why not make this...umm...unique holiday an international affair? Isn't RegEx an international language? :)


May 28, 2008 at 10:27 AM // reply »
6,516 Comments

@Brian,

Cut me some slack - it's the first holiday I have ever created :) But yeah, it can be international.


May 28, 2008 at 10:42 AM // reply »
3 Comments

LOL


May 28, 2008 at 11:01 AM // reply »
6 Comments

Regex rocks!


May 28, 2008 at 11:11 AM // reply »
102 Comments

That XKCD shirt is great! I began writing my own regular expressions at my blog, as I kept finding them useful, and forgot to add snippets in Eclipse for them. Certainly an easier way to keep track of them. I have (slight) programmer's OCD, and like my code a certain way, so I ended up writing my own CF page that goes through my old CF code (that was not formatted correctly) and rewrites it with corrected spacing and upper/lowercasing, using RegEx to make all of the find/replaces. Certainly much easier than going through by hand and doing it (my OCD isn't *that* bad :) )


May 28, 2008 at 11:11 AM // reply »
39 Comments

The book "Mastering Regular Expressions" by Jeffrey Friedl is the book which I would choose if I could keep only one.

I wrote a review of it on my blog, but I feel like I try to plug myself too often here, so I won't link it - though it shouldn't be too hard to find if you follow the link on my name =).


May 28, 2008 at 11:22 AM // reply »
39 Comments

Also, that shirt is cute, but it's always bothered me as it reads "2 B's or Not B twice" - Argh, urge to regex rising!

This is better:
/(?=bb)|(?!bb)/

Or if it needs to consume/capture (since (?=...) and (?!...) are non-consuming look-aheads):
/(?:(?=bb)|(?!bb))(..)/

PLUS! maybe it should end in /i so that it's case insensitive!

Sed/vi:
s/(?:(?=bb)|(?!bb))(..)/The question is \1/ig

Aah, there, nerdiness satisfied.


May 28, 2008 at 11:25 AM // reply »
6,516 Comments

@Eric,

Ha ha ha :) Awesome.


May 28, 2008 at 11:29 AM // reply »
1 Comments

I thought I was odd organising an National (now international) Shed week, but without Regular Expression my CF shed site could not run.


May 28, 2008 at 11:37 AM // reply »
18 Comments

If I were to use Regex Buddy, which variation of Regex would I select for Coldfusion? Does it use the Java version?


May 28, 2008 at 11:46 AM // reply »
6,516 Comments

@Dan,

I assume it uses the Java set of regular expressions, but I am not 100% sure.


May 28, 2008 at 11:50 AM // reply »
39 Comments

@Dan:

I don't think it's exactly the Java version, but I think that's probably what it's closest to. In reality it's not very likely you'll stumble upon the differences between them unless you're doing some reasonably advanced stuff anyway.

Most people stick to capture grouping (...), non-capture grouping (?:...), character classes [a-zA-Z0-9], match any character . , previous 0 or 1 times ?, previous 0 or more times *, previous 1 or more times +, and alternation (aka "or") |. These are common to every reasonably major regex system (though LUA doesn't support alternation!!)


May 28, 2008 at 11:51 AM // reply »
20 Comments

man, why'd you have to make it on a sunday? should have gone for monday, june 2nd so we could have had the day off work (i love 3 day weekends).

i'd be proud to wear the shakespeare regex shirt to commemorate next year's (inter)national regular expression day (which falls on a monday! w00t!) :)


May 28, 2008 at 11:59 AM // reply »
26 Comments

I would not suggest mastering regex to the average person - it's just too much information. Yes, I've read it but I'm far from normal. :)

What I do suggest is RegEx in 10 minutes by Ben Forta (http://www.informit.com/store/product.aspx?isbn=0672325667)
It's a good book and I happen to know the tech editor intimately. He's good. :)


May 28, 2008 at 11:59 AM // reply »
177 Comments

"And, what can you wind, you ask?" o_O I can't wind anything, but I can try to win something with regular expression!

psst! Ben! blog typo. :)


May 28, 2008 at 12:02 PM // reply »
177 Comments

@Michael Dinowitz: Like... how intimate? Does Judith know about this?


May 28, 2008 at 12:05 PM // reply »
6,516 Comments

@Todd,

Good catch :)

@Michael,

The book has been added to the list. Thanks for the suggestion.


May 28, 2008 at 12:16 PM // reply »
53 Comments

At home I keep my copy of the Regular Expression Pocket Reference right next to my copy of Strunk & White's Elements of Style.

Both are essential references books in my life.


May 28, 2008 at 12:16 PM // reply »
17 Comments

$madness =~ /method/


May 28, 2008 at 12:33 PM // reply »
32 Comments

I'd take the shirt. I've already got both books and I am happy with Expresso.

I wish more of my colleagues would learn RegEx--it's such a drag when I get excited about a RegEx solution and none of the other's care. . .sniff. . .they probably won't even appreciate the t-shirt.


May 28, 2008 at 12:41 PM // reply »
39 Comments

@David: I hear you! I'm looking at YOU, Brian! =)


May 28, 2008 at 1:26 PM // reply »
164 Comments

> post a comment below [...] on how
> much you like regular expressions

I will express my love in regex.

(?i)(me)?(?(1)\u2665((?:reg(?:ular expressions?|ex(?:p|e[ns])?)))|(?!))(?>\1\2)

@Eric, I've debugged that shirt, too. See: http://blog.stevenlevithan.com/archives/2b-or-not-2b :-)


May 28, 2008 at 1:32 PM // reply »
6,516 Comments

@Steve,

That's a bit beyond my level :) If I had to make an educated guess, are you using a conditional for Me\I and then [Heart] different spellings of regular expressions?

That ?(1) is a conditional right?


May 28, 2008 at 2:15 PM // reply »
164 Comments

@Ben, yes. More specifically, it's what I call a capturing-group-participation-based conditional, which is a bit of a mouthful (and is not official terminology for any particular regex flavor).

For the sake of deriving some kind of meaning, I suggest you read the regex as "If match 'me', match '[heart] regular expressions', then place 'me' and 'regular expressions' in an atomic group; otherwise end the match". It would match a string like "Me♥RegexMeRegex".


May 28, 2008 at 2:23 PM // reply »
6,516 Comments

@Steve,

Niiice :)


Jim
May 28, 2008 at 6:35 PM // reply »
16 Comments

I dig the regEx. I'd love to win the 2b regex shirt.

-j


May 28, 2008 at 10:48 PM // reply »
7 Comments

Here in Australia we actually get the 2nd of June off (as some unimportant incidental public holiday - unrelated to technical advances anyways), and since we've got this policy of moving our public holidays to the Monday any time one falls on a weekend, it's just like I get a day off in honour of I.R.E.D.

Hooray!

I was going to post for something (in an effort to obtain the sweet XKCD shirt), but honestly Steve's love for regexes in a regex beats anything I could say :-O

I will say this though:
When I first learned to use them, every problem looked like it would have a regex solution (if you have a hammer, everything looks like a nail syndrome).

The difference is (I was using perl at the time), 9/10 times it did have a regex solution. Usually a good one - a lot of my existing code shrunk from lines and lines to a single line.


May 29, 2008 at 12:03 AM // reply »
1 Comments

Hi!
I love RegEx very much!
This one "Mastering Regular Expressions", please ^_^


May 29, 2008 at 12:55 AM // reply »
1 Comments

hello... it's cool stuff...
I wanna books... about regex...
I use it a lot of time... with python...
It made me comfortable...
because I can reduce my codes...


May 29, 2008 at 1:43 AM // reply »
1 Comments

"Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems."

But really. Gotta love 'em.


May 29, 2008 at 3:13 AM // reply »
1 Comments

Excellent - that xkcd RegEx Shirt is pretty cool, I'd like that


May 29, 2008 at 5:43 AM // reply »
164 Comments

Thanks for starting this, Ben. I've posted my own regex contest / giveaway at http://blog.stevenlevithan.com/archives/regexday-2008 . Of course, everyone here is welcome to participate there as well.


May 29, 2008 at 5:44 AM // reply »
1 Comments

I love regex because I have this huge half-page long pattern to match every single TV show I watch in a couple of IRC channels I'm in. Not to mention wherever else I might be using it (i only wish word and some other text editors supported regex find..) on a daily basis. It saves me so much time I'm only too glad to celebrate a regex day.

/me loser?

Anyway, Steve's regex post owned, but I really want that xkcd shirt :( here's to hoping...


May 29, 2008 at 6:03 AM // reply »
164 Comments

@Jane, I haven't posted what prize I'm interested in, so I'm not in the running (intentionally).


May 29, 2008 at 7:30 AM // reply »
1 Comments

I don't know how anybody develops code without using the regex powers of sed and grep. That's why I'd love to have the book, Mastering Regular Expressions!


May 29, 2008 at 8:56 AM // reply »
1 Comments

that coffee mug is sweet, I have mastering regular expressions and the pocket reference. They are both really good. I also second taking that monday off in observance of the sunday holiday.


seb
May 29, 2008 at 9:24 AM // reply »
1 Comments

Friedls Regular Expression(2nd edition, in German) lies on my desk.
At university, as we had to write a program to query a website and print an result from the site, i used regular expression. My program was the shortest. The lecturer liked it :)
It happened me also that i said at work to a co-worker, "I can do this in regular expression, let me do it".

I would like to get the xkcd shirt.


May 29, 2008 at 9:37 AM // reply »
1 Comments

Awesome idea! Regular expressions deserve more love than they're given.

If chosen, I'd love to win a copy of O'Reilly's Mastering Regular Expressions".


May 29, 2008 at 9:41 AM // reply »
17 Comments

I forgot to specify what I want.

/Shakespeare RegEx Shirt|Mastering Regular Expressions/


May 29, 2008 at 9:47 AM // reply »
8 Comments

That xkcd t-shirt is cool. :)

Input: International Regular Expression Day

/^\w+(\w)\w{4}(\s)(\w{2})(\w)\w+\s(\w{2})\w{6}(\w)\w\s(\w)(\w)\w$/\1\2\8\7\6\3\2\3\4\5!/

:)


May 29, 2008 at 9:52 AM // reply »
8 Comments

Jane:

>> i only wish word and some other text editors supported regex find <<

jEdit has a good search & replace with RegEx find & replace.

www.jedit.org


May 29, 2008 at 10:05 AM // reply »
1 Comments

Happy regex day! I'd like xkcd shirt please...


May 29, 2008 at 10:14 AM // reply »
1 Comments

Dude, I so totally love regex. I totally want the Shakespeare Regex. Totally.


May 29, 2008 at 10:36 AM // reply »
1 Comments

I'm just learning the complexities to RegEx and each day find it more useful, very cool for IRED. One O'Reilly book for learning please. Thx.


May 29, 2008 at 10:42 AM // reply »
1 Comments

As I am finally detoxing off of VB and entering the world of "real languages" I guess I would like: "Sams Teach Yourself Regular Expressions in 10 Minutes".

I have dabbled with them in .NET, but I know I'm not utilizing them even remotely to their potential.


May 29, 2008 at 11:05 AM // reply »
97 Comments

This is very timely. I've found myself increasingly using regex lately to elegantly solve problems we're addressing in our Broadchoice Web Platform! Hardly a day goes by now without me concocting a regex to paste into a Trac ticket to show our offshore team how to perform complex matches or replacements on text, especially related to URL patterns. I always used to think regex was a bit of a hammer and that regex fans thought all problems were nails but as I've become more fluent with it, I've seen the light :)

If I win, I'd love the Shakespeare T - that's very cool!


May 29, 2008 at 11:07 AM // reply »
2 Comments

I've been amazed at what you can accomplish with regular expressions to shorten lots of code. I've also been amazed at how complex and cryptic the regex code can get!

One current problem I'm struggling with is how to replace delimiters around text with HTML tags in a ChordPro-formatted string using ColdFusion. e.g. parsing "A[G]mazing [G7]grace, how [C]sweet the [G]sound" looking for the square brackets and replacing them with <span class="chord"> and </span> respectively... So the final string might look like, "A<span class="chord">G</span>mazing <span class="chord">G7</span>grace, how <span class="chord">C</span>sweet the <span class="chord">G</span>sound" Any ideas? Also is there any way to get the chord out and pass it to a transpose function inside the regex?

Shakespeare T all the way!


May 29, 2008 at 11:10 AM // reply »
2 Comments

Forgot to mention that most of the solutions for transforming ChordPro markup to HTML involves creating a two-row table for each row of ChordPro text. I'd really like to figure out how to format it using CSS instead of tables. :-) That's proving to be a little more difficult than I anticipated when I started it. Most of the open-source tools also use tables...

-matt


May 29, 2008 at 11:13 AM // reply »
6,516 Comments

@Matt,

Try:

(?i)(\[[abcdefg]\d?\])

... and replace with:

<span class="chord">\1</span>


May 29, 2008 at 12:02 PM // reply »
1 Comments

Yes, I love regular expressions. They are pretty much the only way to process textual information containing patters easily.

And I want a cool T-shirt! Thanks.


May 29, 2008 at 12:42 PM // reply »
1 Comments

Regular expressions have become my life force in the last few weeks when I found out my beloved ereg in PHP is being phazed out. Far more portable and fast it makes my life that much better!


May 29, 2008 at 1:00 PM // reply »
1 Comments

I'd love to own the first prize, the Shakespeare TShirt. I've always loved that different kind of art approach (I even loved the Poems in UML things ;))


May 29, 2008 at 1:07 PM // reply »
1 Comments

RegEx: The most powerful thing that none of our programmer applicants ever seem to know much about. Sad.

I would love either one of the tshirt (1 or 2)


May 29, 2008 at 1:09 PM // reply »
1 Comments

Yay for RegEx Day!

Regular Expressions are a wonderful way to express your awesomeness. My favorites are the ones that do menial tasks for me, such as reformat text in my editor. I blogged it, even: (http://www.dopefly.com/techblog/entry.cfm?entry=222 and 223).

A couple years ago, I made a little util to rename files based on any regex: (http://www.dopefly.com/techblog/entry.cfm?entry=106).

Also, back in '04, I made the Viagra Expression - a big regex to counter viagra spam. You can test it online here: (http://www.dopefly.com/projects/viagratester.cfm). Always meant to circle back and improve it, but I keep forgetting.

If I win something, I think either T-shirt (L) or the O'Reilly book would be fantastic.


May 29, 2008 at 1:25 PM // reply »
7 Comments

RegEx's rock. Great for validating an entire CSV line at one time baby.

^[Man created beer]

Luv the "Shakespeare RegEx Shirt"


May 29, 2008 at 2:17 PM // reply »
1 Comments

I like the Shakespeare shirt.


May 29, 2008 at 2:22 PM // reply »
5 Comments

^I am the RegEx Ninja! I love RegEx so much, I already own two of those. {2} of those? I'm not averse to owning {2,}. After all, regular expressions have [class].


May 29, 2008 at 2:23 PM // reply »
5 Comments

Oh, and to fulfill the requirements, I want to run Hamlet in a shell. Possibly Denmark, the nutshell.


May 29, 2008 at 2:35 PM // reply »
3 Comments

I never really appreciated regular expressions until I had to do manual string search and replacement....dear God.

Complicated stuff but powerful and worth-while. It should have a birthday that is celebrated all around the world.


May 29, 2008 at 2:39 PM // reply »
39 Comments

Another one: I am /(^).*($)/

Ack, that looks like a crazy Asian emoticon! Non-capturing sub-grouping is in order!

In the spirit of http://xkcd.com/208/ :
i =~ m/(^)(?:.*)($)/;


May 29, 2008 at 2:46 PM // reply »
3 Comments

I just wish I could master regex.

prize 4.


May 29, 2008 at 2:53 PM // reply »
164 Comments

@Eric, how do you read those? I'm sure I'm missing the joke.


May 29, 2008 at 3:04 PM // reply »
6,516 Comments

@Steve,

I thought maybe he was trying to say that he is "empty"? That's what I got from the non-capturing group :) But, some clarification would help :)


May 29, 2008 at 3:09 PM // reply »
5 Comments

i =~ m/(^)(?:.*)($)/;
is a little nonsensical. In perlish, I think it roughly translates as "I match everything." To be honest, I'm not sure what you get when you combine the binding operator (=~) with the match operator (m//).


May 29, 2008 at 3:10 PM // reply »
39 Comments

It's probably pretty obscure. I meant it as "I am the beginning and the end" or "I am the alpha and the omega"


May 29, 2008 at 3:16 PM // reply »
6,516 Comments

@Eric,

Ahhh, gotcha. On a side note, I have always loved that phrase, "I am the alpha and the omega." I always thought it was very badass sounding.


May 29, 2008 at 3:42 PM // reply »
8 Comments

>> I have always loved that phrase, "I am the alpha and the omega."

Me too - ever since playing against Xan in Unreal Tournament. :)


May 29, 2008 at 4:38 PM // reply »
164 Comments

@Ben Doom, I'm not a Perl hacker, but I know that adding the "m" in `i =~ m/(^)(?:.*)($)/;` doesn't change anything. Some people have a preference to always use it, or not.

@Eric, the parens and the bit about some adjustments being in the spirit of xkcd/208 threw me off, but "I am the alpha and the omega" was actually my best guess at reading it the way you meant it. :-)

Since I can't help but comment even on joke regexes, I'd recommend something like this to help get the point across:

i =~ /\A.*\z/s


May 29, 2008 at 5:04 PM // reply »
5 Comments

@steven

I meant that you usually use =~ with the replacement operator, so that the result is bound back to the variable. IIRC (it's been a few years)

me =~ r/(ben)?\s*doom/The RegEx Ninja/ig;

Poof! The Ninja appears from nowhere!


May 29, 2008 at 5:17 PM // reply »
164 Comments

@Ben Doom, lolz. :)

(Again, not a Perl hacker, but replacements are done with s/// [s stands for substitution].)


May 29, 2008 at 5:23 PM // reply »
5 Comments

@Steven

You're right, it's s///. I *always* got that wrong, now that I think about it.


May 30, 2008 at 12:23 AM // reply »
1 Comments

All of those prizes are great so feel free to send along any of them.


May 30, 2008 at 1:32 AM // reply »
1 Comments

<Regex3


Can
May 30, 2008 at 10:33 AM // reply »
1 Comments

I wrote the history of meeting Regex at the first time in my life (on the my web page) and some SQL queries' regexes (these are all in Turkish). And also linked to this web page.

I want "Mastering Regular Expressions" by Jeffrey Friedl if I win =:-)


Ben
May 30, 2008 at 11:56 AM // reply »
1 Comments

05/30/08 09:51:35 xkcd tshirt winner!

^.*?:[0-9]{2}\s\w\s\w\s\w$


May 30, 2008 at 2:20 PM // reply »
11 Comments

I love how a colleague will be complaining to me that they have to spend all day making a silly change to hundreds or thousands of files by hand, and I can swoop in and save the day with a quick perl command line. Makes me feel like a hero all the time. :)

I would love either tshirt, or the O'Reilly book.


May 30, 2008 at 5:37 PM // reply »
2 Comments

Regular expressions got me through grad-school!


May 30, 2008 at 5:38 PM // reply »
2 Comments

Regular expressions got me through grad-school!

The xkcd shirt is cool... the O'Reilly book is pretty awesome!


May 30, 2008 at 6:03 PM // reply »
3 Comments

Lol...what got me through some of my projects are regex libraries :P.

On second thought, I'd really like any of those prizes. I'd love the o'reilly book or the 24 hours book but I would love to have any of those :P.


May 31, 2008 at 5:46 AM // reply »
1 Comments

t-shirt!


May 31, 2008 at 6:13 AM // reply »
9 Comments

The first time I realized that RegEx's were f()cking awesome was when I saw RegExPal and parse URI / SplitURL's from Steve ...

I want the Shakespeare shirt ... please ... now.


May 31, 2008 at 8:34 AM // reply »
3 Comments

Hooray for RegEx Day!

Tip: If you're a Dreamweaver user and need to build a regular expression, start learning about the Server Behavior Builder. When you create a server behavior, Dreamweaver generates a regular expression to match the code block(s). If you're in a hurry (or especially if you're just learning regular expressions), the regexes Dreamweaver generates can be a good starting point. You'll find the regexes it generates are in your user's Configuration in .edml files (which are XML files).

Hope that helps somebody out there... :-) Happy Regex Day!


May 31, 2008 at 6:19 PM // reply »
1 Comments

// My comment is a bit larger because it has code + comments!
// I like regular expressions because the're so easy to use and let you quickly
// handle an amazing variety of pattern matching tasks with very little code.
// Written by Art Wetzel sometime in 1976 or 77 about when V7 Unix came out.
// Its not the full RegEx syntax we know today and is slower than the usual
// state-machine implementation. But... It is nice and short!
// This worked nicely as the core of my own little versions of ed and vi
// If I win I'd like the med or large xkcd RegEx Shirt!!!!

/*
* Art Wetzel's recursive regular expression matcher returns # chars matched
* the regular expression p in the target string s. The b arg points to the
* beginning of line for '^' matching (its usually a copy of the initial s)
* a return value < 0 means no match. 0 is a successful 0 len match.
*/
rem(p, s, b) char *p, *s, *b; {
int t;
char *pi;
switch(*(pi = p)) {
case 0: return(0);
case '^': return(s == b ? rem(++p, s) : -30000);
case '$': return(*s ? -30000 : 0);
case '[':
t = (*(p+1)=='^' ? (*s ? !cclass(p+2, s) : 0) : cclass(p+1, s));
while(*p++ != ']') ;
goto recurse;
case '.': t = *s; p++;
goto recurse;
case '\\': p++;
default:
t = (*p++ == *s);
recurse: if(*p == 0) return(t?1:-30000);
if(*p != '*') return(t && *s != 0 ? 1+rem(p,s+1) : -30000);
return(t ? maxf(1+rem(pi,s+1),rem(p+1,s)) : (rem(p+1,s)));
}
}

maxf(i, j) { return(i>j ? i : j); }

cclass(p, s) char *p, *s; {
int c;
for(c = *s; *p != ']'; ) {
if(*(p+1) == '-') {
if(c >= *p && c<= *(p+2))
return(1);
p += 3;
} else if(*p++ == c) return(c);
}
return(0);
}


May 31, 2008 at 11:32 PM // reply »
1 Comments

It good to see how many people are starting to realize how cool regexes are. I saw the light after using a regex to replace text in about 40 files in less than a minute

I wouldn't mind the XKCD T-shirt. I already have the other.


May 31, 2008 at 11:50 PM // reply »
9 Comments

@Angela

Any female that likes RegEx's is definitely cool by me ... { :) }

That Dreamweaver trick is a pretty cool way to learn RegEx's ...

Not to steal your thunder or anything ... but, for an easy way to "Cheat" at learning RegEx's ... By understanding the definitions of RegexBuddy's tokens, a nOOb can pick up the different syntax "flavors" of RegEx string manipulation really quick ...


Jun 1, 2008 at 3:38 AM // reply »
1 Comments

Regexes are so tremendously cool. And so are the t-shirts! I'd really love one of them. Also I would recommend Friedl's book to anyone interested in regexes. One of the best tech books I ever read. Not that I've read that many books, but okay...


Jun 1, 2008 at 7:15 AM // reply »
1 Comments

How cool. First there's Talk Like a Pirate Day and now this!

I have to find a way to celebrate this with my family.


Jun 1, 2008 at 8:42 AM // reply »
8 Comments

((Happy Regex Day To )You\n)\1\2.*!\n\1

:)


Jun 1, 2008 at 9:17 AM // reply »
3 Comments

To celebrate today's holiday, I've compiled 5 Tips for Working With Regular Expressions. (Tip #1 is the tip I left in the comments here, so you can skip that one...) As not to take up a lot of room here on Ben's blog I've posted the tips on my blog instead.

To see all 5 tips, visit http://www.dwmommy.com/?day=6/1/2008#blog627 or click on my name for this comment.

I hope the tips help and that everyone has a wonderful National Regular Expression Day!


Jun 1, 2008 at 9:23 AM // reply »
3 Comments

@Edward - Thanks, one of these days I'll have to look at RegexBuddy (too bad it isn't on the Mac though, prefer not to switch back and forth to the Windows side)

@Ben - Thanks for hosting, umm creating.... no, inventing -- oh you know what I mean. :-) I see your comments are using a regex to make links out of URLs provided in the comments. Great use for a regular expression there.

@Everyone... Anyone know some good tools for RegExes on the Mac?


Jun 1, 2008 at 5:12 PM // reply »
6,516 Comments

@All,

HAPPY REGULAR EXPRESSION DAY!

I really appreciate everyone that came out participated. I am glad to see that so many people are finding regular expressions as awesome and wonderful as I do. I wish I had had more time to make this first day better, but I am sure the participation we have seen so far is only a sign of bigger and better things to come next year.

Thanks to everyone. Will be selecting winners tomorrow. Until, then, enjoy!


Jun 2, 2008 at 9:27 AM // reply »
1 Comments

:) I think i am too late, but I would like to say that this is Ben's cool effort.


Jun 2, 2008 at 8:36 PM // reply »
6,516 Comments

Congratulations to the National Regular Expression winners below who have been selected at random:

* Sean Corfield
* Andity
* Ryan TJ
* Austin
* Jono

Thank you all for having fun with this and helping to get the first annual Regular Expression Day off the ground! I was really excited to see people expressing a love for the language and really sharing some of the ways it has made their lives easier. I am hope that next year is even more exciting.

I will send each of the winner a follow email to gather the necessary information.

Thanks again everyone!


ike
Jun 12, 2008 at 2:48 PM // reply »
78 Comments

I'm a big fan of API's that auto-correct for common mistakes. For example, if the API says something like Fusebox or ColdBox about including views, i.e "don't include the .cfm extension", which I've done in a number of places, I would write the code so that if they make a mistake and include it anyway, the API will correct the mistake. So frequently in my code you'll see something like this as a quick method of auto-correcting:

rereplacenocase(path,"(\.cfm)?$",".cfm")

remove it if present, then tack it back on. :P

A lot of my regex work ends up being really small pieces like that, rather than big hairy complicated regexes for things like html scrubbing (which I do with XSLT now).


Feb 13, 2009 at 4:38 AM // reply »
16 Comments

Can we have international reg ex day 2009?

I think we've got to keep this thing rolling! :)
I'll help where I can


Feb 13, 2009 at 10:24 AM // reply »
6,516 Comments

@Matt,

Heck yeah we can! This year, we gotta come up something cool. A real neat contest. Put your thinking cap on.


Feb 13, 2009 at 10:42 AM // reply »
23 Comments

Ben, I'd recommend a couple of contests with common real world expressions. They should be sent privately (so people can't take someone else's idea posted before them and make it better). Each contest should be scored on accuracy (does it solve the problem correctly), simplicity (how long is the pattern), and readability (how easy is it to read and understand what the pattern does).

For example: Find all valid email addresses in a file. Your test file should not be public, and should include a lot of things which look like an email address but are invalid, as well as email addresses which look invalid but actually are, such as those which contain a ' character, and should also include garbage around the email address that might accidentally get picked up.

Another example: Find all valid URLs in a file. Your test file should include http and non-http protocols, ports, bogus characters in the domain, named anchors, and trailing punctuation which should be detected and not included (that's a real world example from online forums and whatnot - the URL often comes at the end of a sentence and has a . or ? after it). Bonus points if it uses sub-expression matching to separate out the various parts of the URL such as protocol, domain, port, directory, file, arguments, named anchor.

At the end of the contest, when the winners are announced, the community benefits from having strong, extensible expressions which they can use to solve common problems.


Feb 21, 2009 at 9:21 PM // reply »
6,516 Comments

@Eric,

Good ideas. I like the idea of using patterns to grab parts of a file. I'll take these ideas and see what I can some up with. Time to put the thinking cap on :)


May 18, 2009 at 5:15 PM // reply »
1 Comments

Surprised. Thanks to the author for a good product. It is a pleasure to read. I am your constant reader!


May 25, 2009 at 2:07 PM // reply »
1 Comments

I've just learned about Regular Expressions and I'm positively surprised. I'll keep an eye on this one. Thanx


Jun 1, 2009 at 9:41 AM // reply »
6,516 Comments

It's that time of the year again:

http://sn.im/regex-day-2009

The 2nd Annual (Inter)?National Regular Expression Day!


Jun 10, 2009 at 9:24 PM // reply »
1 Comments

XKCD shirt that is great! I started to write my own regular expressions in my blog, as I have found useful, and forgot to add them to fragments in Eclipse. Surely an easier way to track them. I (light), developer of the OCD, and like my code in a certain way, so it ended up writing my own CF page that goes through my old CF code (which was not the correct format) and rewritten with the corrected spacing and upper / lower case, using Regex to make all the find / replace. Certainly much easier than going through the hand and that is what (my OCD is not * that * bad.


Sep 30, 2009 at 8:14 PM // reply »
1 Comments

hi A lot of my regex work ends up being really small pieces like that, rather than big hairy complicated regexes for things like html scrubbing (which I do with XSLT now).


Post Comment  |  Ask Ben

Recent Blog Comments
Nov 21, 2009 at 5:15 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jose Galdamez, Oh heh yeah I didn't paste the whole code. I should have defined the vars -- my bad. It's fixed thou. Thanks. ... read »
Nov 21, 2009 at 4:49 PM
Styling The ColdFusion 8 WriteToBrowser CFImage Output
Great work yet again Ben! Whilst I didn't use this whole code, I copied some of your regex code for a similar problem with the lack of an alt attribute and unescaped ampersands in CFIMAGE for Railo 3 ... read »
Nov 21, 2009 at 1:13 PM
My First ColdFusion Builder Extension - Encrypting And Decrypting CFM / CFC Files
@Ben, Because I am pedantic, I just want to make sure that everyone knows there is absolutely no encryption going on. There is only encoding and obfuscation. The cfencode tool only obfuscates your C ... read »
Nov 21, 2009 at 12:28 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jody I can't seem to get your code sample to work. If you are still having problems, try this code out and see if it gets you what you wanted. <!--- Comma delimited list with various duplicates ... read »
Nov 21, 2009 at 11:03 AM
Groovy Operator Overloading Does Not Work In The ColdFusion Context
Hi Ben, Thanks for this informative post. Now I am reading ur old posts too ... read »
Nov 21, 2009 at 10:56 AM
HostMySite.com Has The Best ColdFusion Hosting
@Mehul, Yes very nice people, however several downtimes per day which was not acceptable. Hence we had to move out. I am glad you are having good luck with them so far. ... read »
Nov 20, 2009 at 11:32 PM
Five Months Without Hungarian Notation And I'm Loving It
I've used headless camel case for years for not only ColdFusion variables, but also SQL tables and fields... pretty much everything involving code. I also subscribe to the "don't abbreviate and clea ... read »