[tpm] New Regex question
Uri Guttman
uri at stemsystems.com
Sat Oct 27 20:57:28 PDT 2012
On 10/27/2012 08:53 PM, Chris Jones wrote:
>
> The following two regex work.
> Expression before:
> if(Local(TYPE) == 1) then
> 1.25
>
> else
> UNCHANGED
> endif
>
> Run script.
> $expression =~ s/(\s)\1*/\1/g;
> $expression =~ s/(\r\n)+/\r\n/g;
>
> Expression after:
> if(Local(TYPE) == 1) then
> 1.25
> else
> UNCHANGED
> endif
>
> There is likely a way to make that one expression but it is working for
> my needs.
>
and as i said in several other replies, use $1 in the replacement and \1
in the regex. my tr/// version should work for the whole thing. it may
need tweaking as i didn't test it.
uri
More information about the toronto-pm
mailing list