all files / music-notation/roman/ regex.js

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20                                     
'use strict'
 
/**
 * A regex to match roman numbers literals with the from:
 * `[accidentals]roman[element]` where:
 *
 * accidentals: (Optional) one or two flats (b) or shaprs (#)
 * roman: (Required) a roman numeral from I to VII either in upper or lower case
 * element: (Optional) a name of an element
 *
 * @name roman.regex
 *
 * @example
 * var r = require('music-notation/roman/regex')
 * r.exec('bVII')
 * r.exec('IVMaj7')
 * r.exec('ii minor')
 */
module.exports = /^\s*(b|bb|#|##|)(IV|III|II|I|VII|VI|V|iv|iii|ii|i|vii|vi|v)\s*(.*)\s*$/