PHP preg_match bible scripture format

前端 未结 5 1410
眼角桃花
眼角桃花 2020-12-09 20:14

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         


        
5条回答
  •  攒了一身酷
    2020-12-09 21:09

    ([1|2|3]?([i|I]+)?(\s?)\w+(\s+?))((\d+)?(,?)(\s?)(\d+))+(:?)((\d+)?([\-–]\d+)?(,(\s?)\d+[\-–]\d+)?)?
    

    works for almost every book...

提交回复
热议问题