REGULAR.EXP

This file contains a variety of useful regular expressions that can be used in programming for humdrum. This list should be modified and added to when necessary.

##########################################################################

# Matches null global comments ("!!" is all that is on the line)
null_global = "^!!$"

# Matches all null local comment records
null_local = "^!(\t!)*$"

# Matches all null interpretation records
null_interp = "^\\*(\t\\*)*$"

# Matches all null data records
null_data = "^\\.(\t\\.)*$"

# Matches a spine-path record but also matches a null interpretation record
# so it should be used in conjunction with null_interp
spine_path_record = "^\\*(\\+|v|\\^|x|-)?(\t\\*(\\+|v|\\^|x|-)?)*$"

# Matches the NAME of a valid exclusive interpretation.
exclusive_interp = "^\\*\\*[^\t]+$"

# Matches an exclusive interpretation record but it also matches a null
# interpretation record so it should be used in conjunction with null_interp
exclusive_record = "^\\*(\\*([^\t])+)?(\t\\*(\\*([^\t])+)?)*$"

# Matches a totally exclusive interpretation record (i.e. each spine has an
# exclusive interpretation.
totally_exclusive = "^\\*\\*([^\t])+(\t\\*\\*([^\t])+)*$"

# Matches the NAME of a valid tandem interpretation.
tandem_interp = "([vx+^-][^\t]+)|([^*vx+\t^-][^\t]*)"

# Matches a tandem interpretation record (need tandem_interp to be defined) but
# also matches a null interpretation record so it should be used in conjunction
# with null_interp
tandem_record = "^\\*(" tandem_interp ")?(\t\\*(" tandem_interp ")?)*$"

# Matches a record consisting of all spine-path terminators
spine_terminate = "^\\*-(\t\\*-)*$"

# Matches **kern barline tokens.
# Mid-score barlines: (1) equals sign, (2) bar number, (3) letter,
# (4) pause symbol, (5) repeat, (6) visual lines, (7) repeat,
# (8) minus sign, (9) at-sign.
# Terminal barlines: (1) two equals signs, (2) pause symbol,
# (3) repeat, (4) visual lines, (5) minus sign, (6) at-sign.

singlebarline = "^=([0-9]+[a-z]?)?;?(:?[|!'`\"]+:?)?-?@?$"
doublebarline = "^==;?(:?[|!'`\"]+)?-?@?$"

# Matches **kern barline record. (Needs testing.)

singlebar_record = "^=([0-9]+[a-z]?)?;?(:?[|!'`\"]+:?)?-?@?(\t=([0-9]+[a-z]?)?;?(:?[|!'`\"]+:?)?-?@?)*$"
doublebar_record = "^==;?(:?[|!'`]+)?-?@?(\t==;?(:?[|!'`\"]+)?-?@?)*$"