Abjad / abjad

Abjad is a Python API for building LilyPond files. Use Abjad to make PDFs of music notation.
https://abjad.github.io
GNU General Public License v3.0
239 stars 39 forks source link

Make regex match stricter? #1477

Closed jgarte closed 2 years ago

jgarte commented 2 years ago

The matches here allow strings like "zz,,," or zl,,,:

        match = re.match(r"^([a-z]+)(\,*|'*)$", name)
        assert match is not None, repr(match)
        name, ticks = match.groups()
        return class_.from_ticks(ticks)

https://github.com/Abjad/abjad/blob/587c8064ccdfc4eb786f88c877b1824291d707d5/abjad/pitch.py#L1120

Should we make the regex stricter?

trevorbaca commented 2 years ago

I think it's probably ok to leave. If zz,,, were a recognized pitch name then it's octave number would be 0.