I haven't had time to check this out fully yet, but the following is a quick
guide to guitar tabs:
The six strings of a guitar, from lowest to highest pitch, are tuned EADGBE.
Thus a tab of 333x22 would mean 3rd fet on the E, A and D strings, the G
string muted (not played) and the 2nd fret on the B and E strings. This is
the normal tablature for chords where all the notes are from up to but not
exceeding the 9th fret. Beond the 9th fret, one or two spaces are left to
make it clear which strings are being played and at what fret. Thus '999x
10x' would mean 9th fret on the E, A & D strings, the G and E strings muted,
and 10th fret on the B string. However, some tab writers might equally show
this as '999x 10 x' or '9 9 9 x 10 x '. Whatever the denotation, there
should always be a reference to all 6 strings. Your reference to 'x11 10'
would therefore mean the (low) E string muted, 1st fret on the A & D
strings, 10th fret on the G string, but would be an incomplete tab as it
doesn't give the fretting for the B and (high) E strings (I also doubt if it
could be played as the person who could bridge his fingers between the 1st
and 10th frets probably hasn't been born yet

. Similarly your 'x999 10 11
12' chord is actually a tab for a seven string instrument. No problem
though - as you say, you don't play guitar.
It's important to appreciate that one x (or X) , or one digit (0-9), or two
digits (11-24), can all refer to any one string. I'm not at all worried if
the regex extends up to 29 (in fact there might be the odd 1 in a million
guitars that extends to a 29th fret).
I don't have a problem with working out what number or X refers to what
string and am enirely confident I can split an indvidual chord tab
correctly. My problem is finding a flexible pattern match to correctly
identify when a chord is a chord.
Will check out you proposed regex ASAP, but meanwhile if you've got any
further ideas having read the above, I'd be delighted to hear them.
Graham S
"Ben Morrow" <> wrote in message
news:4st0k9-...
>
> Quoth "Graham" <>:
>> I need a pattern match that will match all of the following (and other
>> variants too)
>>
>> x1234x X99 10 10x x 12 12 12 12 12
>>
>> The characters refer to chord fingering on a 6 string guitar. Up to the
>> 9th
>> fret, the figering is usually tabulated as on the left above, but beyond
>> this one or two spaces are usually left between double figures encounted
>> from the 10th-24th frets.
>
> Patterns of the first and third type (assuming I've understood correctly
> where Xs can appear: I don't play the guiter) can be matched with
> something like
>
> m[
> ([xX])? (?:
> ([1-9]){0,4} |
> [ ]{0,2} (?: ([12]?[0-9]) [ ]{1,2} ){1,4}
> ) ([xX])?
> ]x
>
> Note that this will match the empty string, which probably isn't right;
> are 'x' or 'xx' alone valid? If not you can change the 'compact' part of
> the match to ([1-9]){1,4} to require at least one digit somewhere. Also
> note that this will allow fret numbers up to 29; if that matters you
> could change the 'extended' fret number match to (2[0-4]|1?[0-9]).
>
> Including patterns of the second type is harder. How do you know whether
> 'x11 10' is 'two fingers on 1 and one on 10' or 'one finger on 11 and
> one on 10'? Is there always a space after an initial 'x' if the first
> group of digits is a single fret number? (Is there always an initial
> 'x', in which case the pattern above could have been simplified?)
>
> If a pattern with no initial 'clustered' digits always starts with
> 'x ' then we can use that to distinguish:
>
> m[
> (?: ([Xx]) | ([Xx])? ([1-9]){0,4} )
> (?: [ ]{1,2} ([12]?[0-9]) ){1,4}
> ([Xx])?
> ]x
>
> All the points in the second paragraph above appy here, as well; in
> addition, this will allow patterns for chords with more than four
> fingers, such as 'x999 10 11 12'. That can't be sensibly fixed within
> the regex, but can be easily checked by counting the capture groups
> afterwards.
>
> Ben
>