Fiddle with for a bit...Notice in the thread MPasini had a pattern that worked on your example. However I modified your example to include possibilities that could arise...And I'm not sure if I have got all of these.
Here is the example I came up with: ____ B7 E A Am E This is a line of a song E This is a line of a song B7 E E7 This is line 7 of a song A This is a line of a song E This is the 9th line of a song B7dim This is a line of a song aug E A Am E This is a line of a song dim C D E F G A B C#m A small flower C D E F G A B♭ C Am I going ______ Depending on the result you desire either replace or extract with: ^([A-G\s])(?(1)([A-Gm679#♭iu\s]+)$) On Saturday, February 2, 2019 at 11:59:49 AM UTC-5, jgill wrote: > > I've been banging my head all afternoon trying to derive a regex the will > identify lines (of a song) that contains chords. > > eg > > E B7 E A Am E > This is a line of a song > E > This is a line of a song > B7 E E7 > This is a line of a song > A > This is a line of a song > E > This is a line of a song > B7 > This is a line of a song > E A Am E > This is a line of a song > > There could be spaces before or after the chord names and the only way I > can think to distinguish chords from regular words is that chords are > likely to have more than one space after them - or a newline > > I've got as far as [A-G][6|7|9|m|#|♯|b|♭|aug|dim] > > but the spaces and newlines have me flumoxed. > > Can anyone help? > -- This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "supp...@barebones.com" rather than posting to the group. Follow @bbedit on Twitter: <https://www.twitter.com/bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+unsubscr...@googlegroups.com. To post to this group, send email to bbedit@googlegroups.com. Visit this group at https://groups.google.com/group/bbedit.