我正在尝试构建一组正确识别一组字段类型的正则表达式模式,但无法弄清楚如何让它们全部互斥。这些语法约定似乎总是刚好有足够的重叠,以至于我进行了我不想进行的匹配。
变量:捕获所有
$字段
$field_with_underscores
标准字段:捕获表格,捕获第一个点之后的所有内容
$table.field
$table.field.subfield
$table.field.subfield_with_underscores
$table.field_with_underscores
$table.field_with_underscores.subfield
$table.field_with_underscores.subfield_with_underscores
自定义字段:捕获表,捕获 c$ 之后的所有内容
$table.c$字段
$table.c$field_with_underscores
自定义对象系统属性:捕获表,捕获对象,捕获 $ 之后的所有内容
$table.object$字段
$table.object$field_with_underscores
到目前为止,我有以下内容:
变量:工作
^\$[a-zA-Z_]+$
标准字段:不工作,选择自定义对象系统属性
\$([a-zA-Z_]+)\.([^c\$][a-zA-Z_\.]+)[\,]?
自定义字段:工作
\$([a-zA-Z_]+)\.[c]\$([a-zA-Z_]+)
自定义对象系统属性:工作
\$([a-zA-Z_]+)\.(?!c\$)([a-zA-Z_]+)\$([a-zA-Z_]+)
有人可以帮我吗?我很快就没有头发可以拔了...:\