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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.