Title |
Test
Find
Pattern Title
|
Expression |
^[a-zA-Z_]{1}[a-zA-Z0-9_]+$ |
Description |
This expression validates for valid C# or C++ identifier |
Matches |
_12ffsd | abcd123 | abcd_23232 |
Non-Matches |
..// | ..13e232 | abcd 3232 |
Author |
Rating:
Not yet rated.
Ashish Sheth
|
Source |
|
Your Rating |
|
Title: 'a' not an identifier?
Name: anony
Date: 2/28/2007 6:24:26 PM
Comment:
If '+' signifies 1 or more, which it typically does, then by this expression, all single letter entities of the form 'a', 'b' ... 'z', 'A'... 'Z', '_', are NOT identifiers. But clearly in C# and C++, they are. I think what you need here is '*', not '+'.