That doesn't do exactly what I want it to, but I see now how to work it! Many thanks!
The "JL:ref2" part of the link is static. The "ref2" is a link style so it doesn't actually need to be changed so I wasn't sure what it was you were doing with it. I also didn't need the "s." in front of each number. Just the first. You have given me the tools I need to figure it out though!
UPDATE
Okay, here's what I developed from it:
sub link_numbers ($$) { my $data = $_[0]; my $link = $_[1]; $data =~ s/([s]?s\. )?(\d+(?:\.\d+)?(?:\([^\)]+\))*)/<JL:ref2,\"$li +nk $2\">$1$2<\/JL>/g; return $data; } while ($line = <DATA>) { $line =~ s/ ((?:(?:[s]?s\. )?\d+(?:\.\d+)?(?:\([^\)]+\))*(?:, | an +d | or )?)+)((?: of| the|,)+ )(<JL:ref2,\"([^\">]+)\">)/" " . link_nu +mbers($1,$4) . "$2$3"/ge; print $line; print "\n"; } __DATA__ This can be found in ss. 3 and 4 of the <JL:ref2,"Interpretation Act"> +Interpretation Act</JL>. As discussed in s. 3 or 5 of the <JL:ref2,"Interpretation Act">Interpr +etation Act</JL>. Filling up space in ss. 3, 4, 5, 6, 7 or 8 of the <JL:ref2,"Interpreta +tion Act">Interpretation Act</JL> .
Again, many thanks. You saved my bacon.
In reply to Re: Re: Text Processing - Constructing Hyperlinks
by meraxes
in thread Text Processing - Constructing Hyperlinks
by meraxes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |