On 3/23/06, Gary Kline <[EMAIL PROTECTED]> wrote: > > Guys, > > perlmonks was helpful in explaining that "[[](\d+)[]]" is > what is required to match [NN]. So that will catch the > footnote numbers. I had thought that I would have to do the > <A NAME="NN"> NN xyz </A> anchor by hand. Maybe not, if > somebody can clue me in on the perl regex for matching > > "NN plus any/every character following until \n" > > I can't find my regex book, and am not exactly clear if this > will work, but if I go back over my files and insert braces > around each note (at the page bottom) like: > > {14, DEWEY AND TUFTS, *Ethics*, pp 345-7, § 4 } > > would this: > > s/{(\d+)}(.+)/ > > capture the "14" plus the rest on the bracketed line? The > HTML would be (methinks): > > <A NAME="14">14, DEWEY AND TUFTS, *Ethics*, pp 345-7, § 4 </A> > > with the $1 capturing the 14 and $2 capturing the rest? > > The entire s//g expr would be:: > > s/{(\d+)}(.+)/<A NAME="$1> $1 $2 </A> > > If this is right, I'll be very pleased with myself; else I'm > hoping that somebody can clue me in.
{(\d+)} matches {1} or {123} or {89437863896}, but does not match when there's a non-digit (even a whitespace) inside the brackets. If you know that there are no curly braces inside the curly braces you could use just /{(\d+)(.*?)}/ If you're not sure, /{(\d+)(.*)}/ without the /s switch should also work as . will not match a newline. _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"