I'm starting to play with Regular Expression and have a very basic question:
I tried the regular expression ^\d$ thinking it would only recognize expressions with numbers, and here is why
1) the ^ means the expression has to begin with whatever follows it, right? in this case a number
2) the $ means the expression has to end with whatever precede it, right? in this case a number.
if my assumptions were correct, it would not recognize a1 or aaaa4, but it does. Where am I wrong?
Here is the little program I'm using to check my expressions.
static
void Main(string[] args)
{
if (Regex.IsMatch(args[1], args[0]))
Console.WriteLine("Input matches regular expression");
else
Console.WriteLine("Input does not match entry");
}
Thanks in advance.