Em Andamento

Regular Expression - search/replace bible verse with hyperlink

I need two regular expressions to search and replace all bible verses in an html file with hyperlinks.

I already have the regex that locates the Bible verses and it works great with one very small change needed.

What I need is the regex expression for the replacement text (the hyperlink).

Here is a sample Bible verse:

John 3:16

Here is the text that I want it replaced with:

<a href="[url removed, login to view] 3:16;&version=49;">John 3:16</a>

The regex that locates Bible verses is:

(?:\d|I{1,3})?\s?\w{2,}\.?\s*\d{1,}\:\d{1,}-?,?\d{0,2}(?:,\d{0,2}){0,2}

It works wonderfully except when there are two verses separated by a comma like this: John 3:16, 17

When there is no space before verse 17 (like this "John 3:16,17") it works properly when there is a space before verse 17 (like this "John 3:16, 17") it misses the 17 at the end.

So to summarize:

1) I need the Bible verse locating regex modified to account for the possible space before the second verse

2) I need a regex to use to replace verses with hyperlinks

Habilidades: Engenharia, MySQL, PHP, Arquitetura de software, Teste de Software

Ver mais: bible verse regex, expression bible verses, regex bible verse, regular expressions bible verses, bible verse regular expression, bible passage regular expression, what is a regular expression, use regular expressions, sample regular expressions, regular expressions in c, regular expressions c, regular expression no, regular expression in c, regular expression c, regular expression a, regular expression 0, regex is, great expressions, c regular expressions, biblegateway, replace, regular, php regex, locating, john w

Acerca do Empregador:
( 29 comentários ) United States

ID do Projeto: #3029559

Premiar a:

mtsconsulti

See private message.

$21.25 USD em 2 dias
(5 Avaliações)
4.3