RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Musical chords in online chord sheets
Expression
(?<=(\s|-|\/|\\|\())([A-G][b#]?[m]?((6\/9|11|13|[679]))?((dim|dom|aug|sus|min|maj|add|no|m|M|-|\+)(11|13|15|[23456789])?){0,2}([b#\-\+][59]){0,2}(\/[A-G][b#]?)?)(?=(\s|-|\/|\\|\)|$))
Description
I crafted this crazy regex for matching chords in song sheets you find online. It matches a ton of different combinations, including some very weird/advanced chords like double suspended and chords with extra flats/sharps. The whole matching part is enclosed in parentheses so I can quickly find chords in a document and wrap them with square brackets.
Matches
A|Ab7#9b5|G#6/9|C#sus2sus4|C6+G|Cm/G
Non-Matches
Dm/9|Aadd9aug13m6|min|Abs
Author Rating: The rating for this expression. Steve Blair
   Displaying page 1 of 1 pages; Items 1 to 1

Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials