home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!howland.reston.ans.net!spool.mu.edu!hri.com!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!aun.uninett.no!nuug!symbas!hans
- From: hans@symbas.UUCP (Hans Aafloy)
- Newsgroups: comp.lang.perl
- Subject: pattern matching
- Message-ID: <3730@symbas.UUCP>
- Date: 12 Jan 93 17:48:59 GMT
- Reply-To: hans@symlab.UUCP ()
- Organization: Symbiotic Computer Systems A/S, Trondheim, Norway
- Lines: 15
-
- I expexted the constructs /\d{1,1}/ or /\d{1}/
- to match single digits only, but it seems to match multiple digit
- numbers as well.
- My problem is trivial, and I know a couple of ways to get around
- it, but since I'll use Perl a lot in the future, I want to get to
- the bottom of things like this.
-
- I simply want to insert a leading zero in front of a one digit date:
- s/ *(\d{1})/0$1/;
- and it replaces 88 with 088 as well as 8 with 08.
-
-
- Thanx for any hints.
-
- Hans
-