I am trying to break down a note in abc notation into it’s parts:
accidental (optional) ^^,^,=,_,__
note (mandatory) A-G or a-g
octave (optional) as many apostrophes or commas as necessary
multiplier (optional) integer or fraction
This is what I have to test it:
[QUOTE]
// <-accidental—–><-note–><octve><ml>< / ><dv>
var anote = /(^*|,*)(/?)(d
var longnote = “__g’2/3”;
result = longnote.match(anote);
if (result != null) for (var i = 0; i < result.length; i++)
alert(i + ” ” + result[i]);
else alert(“Result longnote was null”);
var shortnote = “C”;
result = shortnote.match(anote);
if (result != null) for (var i = 0; i < result.length; i++)
alert(i + ” ” + result[i]);
else alert(“Result shortnote was null”);
There was nothing on the error console, but the null alert came up twice. What is missing in the regular expression (or anywhere else)?
Thanks in advance.