>Howdy!
>
>I'm having some trouble coming up with a regex matching expression for a small string format:
>
>C3#:4.
>-or-
>F4-:16t
>-or-
>E2b
>
>
>These represent musical notes.
>
>"C" is the base note (A - G, uppercase only).
>"3" is the octave (1 - 6).
>"#" is the accidental (optional: can be "#" sharp, "b" flat, "-" natural, or "" omitted).
>":" is required if anything follows...
>"4" is the duration (1 whole, 2 half, 4 quarter, 8 eighth, 16 sixteenth, 32 thirtysecond)
>"." is the duration modifier (optional: can be "." dotted, "t" triplet, or "" omitted)
>
>So the first char must be [A-G] and the second char must be [1-6]. After this it gets a little hairy. The accidental is optional, so it's possible to have the colon immediately follow the octave digit. If there is a colon, then there must be a duration digit and there cannot be a duration modifier without a duration digit.
>
>Thanks!
Keith,
No testing, but have a go at this
^([A-G][1-6][-#b]?(:(1|2|4|8|16|32)[.t]?)?)$
Gregory