So try this:
^\s*([A-Z\dm♭#dim]+\s+)+
it’s working on this example:
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
A# E A Am E
This is a line of a song
A♭ Adim E A Am E
This is a line of a song
> On 2. Feb 2019, at 18:45, jgill <[email protected]> wrote:
>
> I need to identify chord lines and non-chord lines so that I can style them
> differently on a web page. Remember, I'm not just looking for [A-G] but A7,
> Am, A#, A♭dim etc
>
> On Saturday, February 2, 2019 at 5:36:42 PM UTC, Marek wrote:
> Hello jgill!
>
>
> You forgot to tell us, what you exactly want to achieve. Do you want to
> extract the lines with the chords?
>
> Try with regex: search with grep case sensitive:
>
> \s*([A-Z\dm]+\s+)+
>
>
> Best greetings from Munich
>
>
> marek
>
>
>
>> On 2. Feb 2019, at 17:59, jgill <joegille...@ <>gmail.com
>> <http://gmail.com/>> 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
>> "sup...@ <>barebones.com <http://barebones.com/>" rather than posting to the
>> group.
>> Follow @bbedit on Twitter: <https://www.twitter.com/bbedit
>> <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+un...@ <>googlegroups.com <http://googlegroups.com/>.
>> To post to this group, send email to bbe...@ <>googlegroups.com
>> <http://googlegroups.com/>.
>> Visit this group at https://groups.google.com/group/bbedit
>> <https://groups.google.com/group/bbedit>.
>
>
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or need technical support, please email
> "[email protected]" rather than posting to the group.
> Follow @bbedit on Twitter: <https://www.twitter.com/bbedit
> <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 [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/bbedit
> <https://groups.google.com/group/bbedit>.
--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"[email protected]" 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.