Regular Expression confusion

From: Christie Taylor (c.taylor_at_no.spam)
Date: 10/31/04


Date: Sat, 30 Oct 2004 21:05:51 -0400

I'm new to regular expressions and am trying to create a fairly simple
one to validate input. The goal is to accept an optional word followed
by zero or one spaces, then a required number of 1 to 8 digits.

I tried m/^word\s{0,1}\d{1,7}/i to get started (ignoring my optional
part) but this is not working, it's matching on way too much. What am I
missing?

Thanks!



Relevant Pages

  • Re: Regular Expression confusion
    ... >> I'm new to regular expressions and am trying to create a fairly simple ... >> one to validate input. ... >> part) but this is not working, it's matching on way too much. ... > Also note that your digit match is not anchored, you can replace it with \d ...
    (comp.lang.perl.misc)
  • Re: Regular Expression confusion
    ... "Christie Taylor" wrote in message ... > I'm new to regular expressions and am trying to create a fairly simple ... > one to validate input. ... "matching on way too much" is not a very good description of your problem. ...
    (comp.lang.perl.misc)
  • [SUMMARY] Statistician I (#167)
    ... The heart of this problem, as suggested in the quiz description, is pattern ... have the pattern matching in place, the rest of the code is pretty trivial. ... use regular expressions, or at least review their knowledge. ... Next, as indicated in the comment, square brackets surrounding text are ...
    (comp.lang.ruby)
  • [Newbie] Referring to a global variable inside a function
    ... I've built a class for parsing a user-defined list of files and matching lines with a user-defined list of regular expressions. ... regular expressions and executing associated actions.""" ... def add_files: ...
    (comp.lang.python)
  • Re: snort & regular expressions
    ... As I understand, snort uses aho-corasick, wu-manber or boyer-moore multi-pattern matching algorithms for literal strings. ... it doesn't match all regular expressions simultaneously. ...
    (Focus-IDS)