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
我不想继续重复[a-zA-Z]和[0-9],所以我做了两个新的定义
DIGIT [0-9]
VALID [a-zA-Z]
How can I rewrite the IDENTIFIER rule to use the DIGIT and VALID definitions?
如何重写IDENTIFIER规则以使用DIGIT和VALID定义?
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.
编辑:我正在使用的整个测试程序:http://pastebin.com/f5b64183f。
2 个解决方案
#1
3
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.
[{VALID} {DIGIT}]解析为[[A-Za-z] [0-9]],这不是一个合法的结构。
#2
-1
I think this'll do it but I can't test it. do you have sample data?
我想这会做到但我无法测试它。你有样本数据吗?
(?:[a-zA-Z])+(?:[0-9])+
#1
3
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.
[{VALID} {DIGIT}]解析为[[A-Za-z] [0-9]],这不是一个合法的结构。
#2
-1
I think this'll do it but I can't test it. do you have sample data?
我想这会做到但我无法测试它。你有样本数据吗?
(?:[a-zA-Z])+(?:[0-9])+