The lost Beginning of line Character for Regex in C# (help needed)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Petimus
    New Member
    • Nov 2008
    • 1

    The lost Beginning of line Character for Regex in C# (help needed)

    Nowhere can I find the beginning of line Character for Regex in C#. Im using the expression [1-9][0-9]*(, [1-9][0-9]*)*$ But without the <Beginning of line>[1-9][0-9]*(, [1-9][0-9]*)*$ my strings are accepted with random letters in them like "1ThisShouldntB eHere7, 12, 2" because it just starts matching at the 7.

    Please I need the beginning of line character for regular expressions in C#... its has become the bane of my existance.

    Thanks,
    Petimus
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Not sure if it's the same in C# as it is in Perl, but you might try the '^' character.

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      I am moving this to the C# forum.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        A quick look at regex for .NET in msdn would have given you the '^' character.

        Comment

        Working...