home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!fmrco!fmrco!asherman
- From: asherman@laser.fmrco.com (Aaron Sherman)
- Subject: Re: stupid questions : deleted ing leading spaces
- In-Reply-To: jhd@irfu.se's message of 7 Sep 92 06:26:49 GMT
- Message-ID: <ASHERMAN.92Sep9160424@laser.fmrco.com>
- Sender: news@fmrco.uucp
- Reply-To: asherman@fmrco.COM
- Organization: I-Kinetics, 19 Bishop-Allen Dr., Cambridge, MA
- References: <1992Sep7.022351.1137@unilabs.uucp> <1992Sep7.062649.20540@irfu.se>
- Date: Wed, 9 Sep 1992 21:04:24 GMT
- Lines: 42
-
-
- >>>>> jhd@irfu.se (Jan D.) said:
-
- jhd> chare@unilabs.uucp (Chris Hare) writes:
-
- >As a matter of of fact, if you can suggest a way to remove the leading
- >spaces, and compact multiple spaces any where else on the line to be one
- >space I'd appreciate it.
- >
-
- jhd> s/^ //;
- jhd> s/ +/ /g;
-
- jhd> If you want to replace general white space (i.e. tabs and space)
- jhd> you should say:
-
- jhd> s/^\s//;
- jhd> s/\s+/ /g;
-
- s/^\s+//; # or s/^ +//; for just spaces.
- s/\s+/ /g; # or s/ +//g; for just spaces.
-
- Otherwise:
-
- " Hello, world!"
-
- turns into:
-
- " Hello, world!"
-
- Not:
-
- "Hello, world!"
-
-
- -AJS
-
- --
- --------
- Disclaimer: I am solely responsible for the content of this message.
- The views expressed here may not be the views of I-Kinetics, Fidelity,
- any of the Fidelity-owned corporations or my mother.
-