[TxMt] regex question
Oliver Taylor
oliver at ollieman.net
Thu Feb 23 07:44:09 UTC 2006
> Try this
>
> #!/usr/bin/perl
> local $/; # put Perl in "slurp" mode
> $text = <>; # read in the whole file
> $text =~ s/(\s+)$//mg;
> $text =~ s{((INT\.|EXT\.|I/E\.|int\.|ext\.|i/e\.)\s.*)$}{***$1}mg;
> $text =~ s/^([A-Z].*[A-Z)])\n^(\(.*\))\n(.+)$/\n\t\t\t\t$1\n\t\t\t$2
> \n\t\t$3\n/mg;
> $text =~ s/^([A-Z]{2,}.*[A-Z)0-9])\n(.*)$/\n\t\t\t\t$1\n\t\t$2\n/mg;
> $text =~ s/^[*]{3}(.+)$/\n$1\n/mg;
> $text =~ s/^(.*(IN:|UP:|TO:))$/\n\t\t\t\t\t\t\t\t\t\t$1\n/mg;
> $text =~ s/^(\w+.*(\.|\?|\!|\"|\-))\n\w+.*(\.|\?|\!|\"|\-)$/\n$1/mg;
> print $text;
Wow, thanks Dr. Drang! That worked perfectly. I'll be releasing the
bundle soon, and i'll be sure to let you guys know.
More information about the textmate
mailing list