Problem with Regex

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mehdiab
    New Member
    • Jun 2010
    • 2

    Problem with Regex

    hi,
    how can i match input string as the below :

    Input :
    number-number,number-number,...,numb er-number
    e.g :
    123-456677,24114-7809,345555-900007 (matches)
    123-456677,-7809,345555-900007 (NOT matches)

    i write the pattern
    Code:
    @"(\d+-\d+,?)+"
    but i do not know where is the problem . and i want to know what inputs matches with my pattern .
    Thanks alot
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    If you want to match the entire input, you need to anchor your pattern at the beginning and end.

    Comment

    Working...