I am trying to build a set of regex patterns that correctly identify a set of field types, but cannot figure out how to get them all mutually exclusive. These syntax conventions always seem to have just enough overlap that I make a match that I don't want to.
Variables: Capture all
$field
$field_with_underscores
Standard Fields: Capture table, capture everything after first dot
$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
Custom Fields: Capture table, capture everything after c$
$table.c$field
$table.c$field_with_underscores
Custom Object System Attributes: Capture table, capture object, capture everything after $
$table.object$field
$table.object$field_with_underscores
So far, I have the following:
Variables: working
^\$[a-zA-Z_]+$
Standard Fields: not working, picks up Custom Object System Attributes
\$([a-zA-Z_]+)\.([^c\$][a-zA-Z_\.]+)[\,]?
Custom Fields: working
\$([a-zA-Z_]+)\.[c]\$([a-zA-Z_]+)
Custom Object System Attributes: working
\$([a-zA-Z_]+)\.(?!c\$)([a-zA-Z_]+)\$([a-zA-Z_]+)
Can someone help me out? I am quickly running out of hair to pull out... :\
^\$([a-zA-Z_]+)(?:\.[a-zA-Z_\.]+)+$
You can try this for standard fields.See demo.
https://www.regex101.com/r/bC8aZ4/8
or
\$([a-zA-Z_]+)(?:(?!.*\$)\.[a-zA-Z_\.]+)+