Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Re: Differential pattern match

Thread Tools

Re: Differential pattern match

Justin C
Posts: n/a
On 2012-10-04, Graham <(E-Mail Removed)> wrote:
> 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.
> The best pattern match I have found so far is
> /[xX0-9][xX0-9\s]{4,20}[xX0-9]/
> This provides for a match of x, X, or a number 0-9 on the extreme left and
> right side, and for a match of x,X, a number 0-9, or a space, for between 4
> and 20 'atoms' between the extreme left and right 'atoms' . However, this
> also picks up the masses of spaces between each chord itself. What I need to
> do somehow is to count the spaces as the regex engine parses and have it
> fail the match if more than two consecutive spaces are encountered. I figure
> that extended regex sequences are probably the way to do this, but I've not
> encountered them before. Any help welcome.

They may not help, but there are several modules on CPAN relating to
tab/guitar tab (I found one for ukelele tab too!). You may find you
what you're doing has already been done.


Justin C, by the sea.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Differential pattern match Graham S Perl Misc 7 10-12-2012 11:11 AM
Re: Differential pattern match Graham S Perl Misc 0 10-06-2012 10:12 AM
SCSI Long Cables, High Voltage Differential Signals and Data Skew? Will Hay A+ Certification 1 03-04-2004 06:44 PM
solving differential equation greg.smith C Programming 3 09-24-2003 09:37 AM