in reply to Re^2: regex to match words and numbers
in thread regex to match words and numbers

The way I understood the OP, the regex should reject all of the example lines, because all of them start with one of (dot, star, word, digit).

That's what my regex does, and everything else (lines starting with a bang, slash, backslash, ...) is accepted.

If that's not what doubledecker wants, he or she should clarify the original posting.

Replies are listed 'Best First'.
Re^4: regex to match words and numbers
by AnomalousMonk (Archbishop) on Jun 09, 2011 at 11:49 UTC
    3. Any line starting with digit and .

    I took this to mean "Any line starting with a digit that is immediately followed by a period". (And I wouldn't be surprised to find this really should be "starting with digits..." rather than "a digit...")

    2. Any line starting with a word

    This is the one that always gives me pause. The common assumption seems to be that the definition, regex or otherwise, of a 'word' is perfectly straightforward, but I can see too many variations to be comfortable with this.

Re^4: regex to match words and numbers
by doubledecker (Scribe) on Jun 09, 2011 at 06:16 UTC
    I need to get lines that start with numbers everything else should be rejected.