Reputation: 3217
I have this working definition:
IDENTIFIER [a-zA-Z][a-zA-Z0-9]*
I don't want to keep repeating the [a-zA-Z] and [0-9], so I made two new definitions
DIGIT [0-9]
VALID [a-zA-Z]
How can I rewrite the IDENTIFIER rule to use the DIGIT and VALID definitions?
I don't know how to do the "second" match, I'm stuck here:
IDENTIFIER {VALID}[{VALID}{DIGIT}]* // This syntax is incorrect
Thanks.
Edit: The entire test program that I'm using: http://pastebin.com/f5b64183f.
Upvotes: 1
Views: 2528
Reputation: 7885
It looks like you actually want:
IDENTIFIER {VALID}({VALID}|{DIGIT})*
[{VALID}{DIGIT}]
resolves to [[A-Za-z][0-9]]
which is not a legal construct.
Upvotes: 4
Reputation: 53101
I think this will do it, but I can't test it. Do you have sample data?
(?:[a-zA-Z])+(?:[0-9])+
Upvotes: -1