Glotmorf on 28 Jun 2002 06:10:03 -0000


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

Re: [spoon-discuss] regex gurus needed


On 6/28/02 at 5:51 AM David E. Smith wrote:

>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

I doubt it'll work.  For one thing, between entropy and haiku, there were a number of spelled-out rule numbers, which you won't catch with that script.  For another, you'd have to know which of all the object numbers generated for the game were rule numbers, because some proposals reference things other than rules by number.

Why not try parsing your vote result messages instead?  At least for a few generations, what you had was

Proposal <#>: PASSED
<vote count>
Amended Rule <#>
Amended Rule <#>
Created Rule <#>

That sort of thing.

						Glotmorf


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