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

Re: regex



>  in perl I would probably do something like:
>  $str=~ s/N+/N/g; 
>  $str=~ s/S+/S/g; 
>  $str=~ s/E+/E/g; 
>  $str=~ s/W+/W/g; 
> 
> maybe there's a smarter way to do it though.
> 

That doesn't solve the problem....that just recognizes arbritrary strings of
the same letter. Here are some examples of strings and their simpified
versions.

SSS       = S
SSSE      = SSSE
EEESEEES  = EEES
ESESESES  = ES
NEESSEESS = NEESSEESS
------------------
Trevor R.H. Clarke                     Computer Science House
Rochester Institute of Technology      Systems Programmer for ISC
retrev@csh.rit.edu                     trcsys@rit.edu
http://www.csh.rit.edu/~retrev/        finger retrev@csh.rit.edu for PGP key