David E. Smith on 28 Jun 2002 05:53:07 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[spoon-discuss] regex gurus needed


I'm trying to add the much-requested "links to revision history proposals"
thing. I don't, however, see why this doesn't work:

while (preg_match('\b[0-9][0-9][0-9]\/[0-9]', $rt)) {
  $rt = preg_replace('\b([0-9][0-9][0-9])/([0-9])',
  '<A HREF=\"http:\/\/www.nomic.net\/~g6\/n2\/history.php?rn=$1\">$1\/$2</A>',
   $rt);
}

It's supposed to look for anything that looks like a rule number (i.e.
123/4 or thereabouts), match that, and replace it with a link to the
relevant proposal.

I know it doesn't cover everything, but it's close enough. (There aren't
any motions with numbers under 100, and it can be expanded to handle
4-digit items when we get there in a couple nweeks.) But it doesn't
presently seem to match anything. I never did really grok regexp, so any
help would be nifty.

(The $1 and $2 in the preg_replace are how PHP handles back-references.)

...dave



---- David E. Smith, POB 515045, St. Louis, MO 63151
http://www.technopagan.org/     http://metadave.net/
http://www.bureau42.com/        http://whatIsay.com/

_______________________________________________
spoon-discuss mailing list
spoon-discuss@xxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/spoon-discuss