User:Bmearns/userbox conv.pl

This is a real simple script I used to subst that huge list of user boxes on /About me. It's real simple and straight forward; just copy paste your list of user boxes (should work with tables, too) into a file called "userboxes.txt", then run the perl script, and it'll write to a file called "converted_userboxes.txt". It'll actually work for all templates, it just uses a simple regex to match the template pattern (only once per line!) and then rewrites it including the subst, and including some fancy-schmany comments to help delineat between the different templates once they're subst'd. If you want to see what it looks like, look at the code for User:Bmearns/About me.

open (fid, "converted_userboxes.txt"); while ($record = ) { if ($record =~ /([^{]*){{([^}]*)}}(.*)/){ printf fwid "\n".$1."".$3."\n\n"; }else{ printf fwid $record; } }

close(fid); close(fwid);