Supposed that I have this text:
Aaron was implicated in the sin of his brother at Meribah (Num. 20:8-13), and on that account was not permitted to enter the Promised Land. When the tribes arrived at Mount Hor, "in the edge of the land of Edom," at the command of God Moses led Aaron and his son Eleazar to the top of that mountain, in the sight of all the people. There he stripped Aaron of his priestly vestments, and put them upon Eleazar; and there Aaron died on the top of the mount, being 123 years old (Num. 20:23-29. Comp. Deut. 10:6; 32:50)
What I want to do is, to convert every bold text above into a link, and the link, if it is:
- Num. 20:8-12, should be like: < a href="num20.8-12">Num. 20:8-13< /a>
- Deut. 10:6; 32:50, should be like: < a href="deut10.6">Deut. 10:6< /a> < a href="deut32.50">Deut. 32:50< /a>
The structure of this text is like below:
<DIV>
<B>Aaron</B>
<SPAN>
Aaron was implicated in the sin of his brother at Meribah (Num. 20:8-13), and on that account was not permitted to enter the Promised Land. When the tribes arrived at Mount Hor, "in the edge of the land of Edom," at the command of God Moses led Aaron and his son Eleazar to the top of that mountain, in the sight of all the people. There he stripped Aaron of his priestly vestments, and put them upon Eleazar; and there Aaron died on the top of the mount, being 123 years old (Num. 20:23-29. Comp. Deut. 10:6; 32:50)
</SPAN>
</DIV>
Any great ideas would be appreciated. Thanks :)
EDIT
The code:
$chapters = array ("Deut", "Num");
$html = file_get_html($link);
foreach($html->find('div') as $dict) {
$descr = $dict->find('SPAN', 0)->innertext;
$descrl = preg_replace("/$chapters\. [0-9:-]*/", "<a href=\"$0\">$0</a>", $descr); //--> See description below
echo $descrl . "<hr/>";
}
Description: While I change the $chapters
into a single word like Num
or Deut
, it works well, but while I change it into $chapters
, it doesn't returns any link.