Skip to main content

Math

warning: Creating default object from empty value in /var/www/venutip.com/public_html/modules/taxonomy/taxonomy.pages.inc on line 33.

The Curious Case of .*

About a month ago, I tweeted what I thought was some pithy advice on the use of .* in regular expressions:

#regex tip of the day: never, _ever_ use .* unless you are forced to do so in a #24-style 
kidnap situation. And even then, think twice.

Funny and topical! But as it turns out, I spoke too soon. Early in Chapter 5 of the superlative Mastering Regular Expressions, the author (Jeffrey Friedl) demonstrates how the judicious use of .* can actually help you to write some very efficient regular expressions.

Who wants lottery tickets!

File under

You know those lottery games where you pick five or six numbers from 1 to 42, or 1 to 55, and if you pick the same numbers that the lottery does, you win some obscene amount of money? A couple of years ago, my wonderful gamblin' grandma bought me a season ticket to a game here in Massachusetts called Megabuck$ (the dollar sign emphasizes that there is big money to be won here, folks). She was a steady long-time lotto player and won some big prizes over the years (though she never won the jackpot). After she got me the ticket, naturally I wanted to know what my odds of winning were.

Syndicate content