regExpression Help

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I'm trying to get a regular expression that matches only 4 digits, i'm
using

Regex.IsMatch(userID, "^\d{4}")

If the user types in more than 4 digits it still is being returned as a
match. Should I be using IsMatch, or is my regular expression wrong?
Thanks.

.



Relevant Pages

  • Re: Please I need help with especific case of permutations algorithm (not usually)
    ... So logically you can stamp your desired digits onto the number to get ... Most MODERN programming language compilers have "Regular Expression" ... = Match the preceding expression at least n times. ...
    (comp.compression)
  • Re: Effective/Proper use of "regular expressions"
    ... parenthesized elements in your regular expression, ... from the set (unless the first character in the bracket expression is ... The range 0-9 is the set of all digits, ... a literal period followed by one or more digits". ...
    (comp.lang.tcl)
  • Re: Regular Expressions
    ... With the other fields in mind, I thought "heck, looks like versions are ... the only ones that contain a series of letters, digits, periods, ... Is it possible to make just one regular expression to ... ABCD 5.0: true because there's a series of digits and '.' ...
    (comp.lang.ruby)
  • Regular Expressions
    ... I'm trying this problem that says I must match versions in a CSV ... the only ones that contain a series of letters, digits, periods, ... Is it possible to make just one regular expression to ... ABCD 5.0: true because there's a series of digits and '.' ...
    (comp.lang.ruby)
  • Question on regular expressions
    ... regular expression (as understood by egrep) to match all addresses ... addresses that contain lowercase letters alone in the first part of the ... the second regular expression above seems to do the job fine. ... If I wanted to match addresses that contain decimal digits alone in the ...
    (comp.unix.shell)