I am struggling with building a regular expression for parsing this kind of strings (bible scriptures):
\'John 14:16–17, 25–26\' \'John 14:16–17\' \'Jo
Use this regex :
[A-Za-z]+( ([0-9]+)(:[0-9]+)?([\-–][0-9]+)?(, [0-9]+[\-–][0-9]+)?)?
Or in its 'prettier' version :
\w+( (\d+)(:\d+)?([\-–]\d+)?(, \d+[\-–]\d+)?)?
UPDATED : To match dashes or hyphens
NOTE : I've tested it and it matches ALL 5 possible versions.
Example : http://regexr.com?30h4q