in reply to Regular Expresion

What did you try?

Rather than being daunted by the problem, try breaking it down into simple steps.

How would you implement something like this?

Replies are listed 'Best First'.
Re^2: Regular Expresion
by JavaFan (Canon) on May 14, 2009 at 12:39 UTC
    I think his problem isn't the "simple steps", but going from "simple steps" to a "complicated total".

    Given that the username may, or may not, preceed the userid, how would you proceed? How would you proceed if there could be 10 fields, in any order?

      I wouldn't use one regular expression. I'd use two -- one for the User ID, one for the name. State information tells you if they're both from the same line.

      I realize brevity is the soul of wit, but I occasionally prefer verbosity if it results in ease of support. (Translation: I'm not as good a programmer as the rest of you...)

        By that logic, you would come to the conclusion being a good programmer means everything is a one-liner.

        I disagree. Multiple lines wins except in the case of repeating yourself.