Re: help needed on substitution regex

2001-11-28 Thread William R Ward
[EMAIL PROTECTED] (Jeff 'Japhy' Pinyan) writes: > On Nov 28, Leon said: > >(Q2)How to do the following :- > > If there are 2 spaces, I wish to convert it into 1   like > >this =>  > > 3 spaces into 2   like this =>    > > 4 spaces into 3   like this =>     > > I

Re: help needed on substitution regex

2001-11-27 Thread Jeff 'japhy' Pinyan
On Nov 28, Leon said: >> s/ ( +)/' ' x length($1)/g; I'm sorry, I left out the /e modifier. s///eg; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions i

Re: help needed on substitution regex

2001-11-27 Thread Leon
- Original Message - From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> To: "Leon" <[EMAIL PROTECTED]> > >(Q2)How to do the following :- > > If there are 2 spaces, I wish to convert it into 1   like > >this =>  > > 3 spaces into 2   like this =>    > > 4 spa

Re: help needed on substitution regex

2001-11-27 Thread Jeff 'japhy' Pinyan
On Nov 28, Leon said: >(Q1)How to put these three substitutions into one single substitution >regex. >$a =~s/$a =~s/>/gt/; >$a =~s/\\n//; You should have the /g modifier on those regexes. But here's how to mash them into one: my %translate = qw( < lt > gt \n ); my $pat = join '|', m