Slashdot Mirror


Can You Do the Regular Expression Crossword?

mikejuk writes "Programmers often say that regular expressions are fun ... but now they can be a whole lot of fun in a completely new way. Want to try your hand at a regular expression crossword? The idea is simple enough — create a crossword style puzzle with regular expressions are the 'clues.' In case you don't know what a regular expression is — it is a way of specifying what characters are allowed using wild-card characters and more. For example a dot matches any single character, an * any number of characters and so on. The regular expression crossword is more a sort of Sudoku puzzle than crossword however because the clues determine the pattern that the entries in a row have to satisfy. It also has to use a hexagonal grid to provide three regular expressions to control each entry. This particular regular expression crossword(pdf) was part of this year's MIT Mystery Hunt. This annual event is crammed with a collection of very difficult problems and the regular expression crossword, created by Dan Gulotta from an idea by Palmer Mebane, was just a small part of the whole — and yes there is a solution."

9 of 115 comments (clear)

  1. Re:Solution by Stradenko · · Score: 4, Informative

    I think you mean .*

  2. simple? by bitingduck · · Score: 4, Funny

    There's probably already a CPAN module for solving it...

  3. Re:Great idea, but... by Anonymous Coward · · Score: 5, Funny

    The only thing difficult about the puzzle is the format in which it is presented. How many people have printers? Of those, how many have working printers? And, of those, how many also have paper?

  4. Re:Solution by Coolhand2120 · · Score: 4, Informative

    The article summary was wrong about * and so are you. At least the language in the summary leaves much to be desired, although they are correct about it being a numerator, they leave off the part that it matches the previous character or subexpression. * = the previous character or subexpression zero or more times. As Stradenko pointed out to get ANY character you need . (period). To get any character zero or more times you need .* (period asterix). To get the solution to anything with more than one line you need [\s\S]*.

    So you're pretty far off the mark as far as 42 goes.

  5. Breaking news. by mutube · · Score: 4, Funny

    Yvonne Lee, Community Manager at Dice.com writes,

    ^\\([^ ()]+\\)\\(([0-9]+\\),\\([0-9]+\\))"

  6. Interactive by Ozan · · Score: 5, Informative

    No need to print out the puzzle, somebody made an interactive version:
    http://twoevils.net/cross-regex.html

  7. Re:Obligatory xkcd by fche · · Score: 5, Insightful

    Randall should draw a comic about obligatory xkcd references.

  8. Re:Great idea, but... by SQLGuru · · Score: 4, Funny

    How many people have printers? Of those, how many have working printers? And, of those, how many also have paper?

    I have all of those........but no ink.

  9. Re:Rules? by pipatron · · Score: 4, Informative

    Everywhere ^ is used in the puzzle it means that it matches anything not in the group. For example [^abc] would match any character except a, b and c

    --
    c++; /* this makes c bigger but returns the old value */