Re: regrex question

2003-03-20 Thread drieux
On Thursday, Mar 20, 2003, at 14:23 US/Pacific, David Gilden wrote: [..] I am trying to get the following as a result: xxx9988 #!/usr/bin/perl -w $card_number = '123456789988'; $card_number =~ s/\d{8}(\d{4})/x'x'8 . $1/e; # not working print "$card_number\n"; I presume when you run that

Re: regrex question part 2

2003-03-20 Thread Wiggins d'Anconia
Remember to always group reply so others can help and be helped. David Gilden wrote: Why am I getting 'one two three' in $s and not just 'one' You might want to print $1, this will give you a better idea. $1 is being set to everything in the parentheses, which is everything you match, and the

Re: regrex question part 2

2003-03-20 Thread Wiggins d'Anconia
David Gilden wrote: In the following why am I getting '23' Is 23 being treated as a string? Not exactly. It is NOT being treated as a number if that is what you mean, all of $s is being treated as a string. Specifically \w matches any "word" character, which is any alphanumeric...so [A-Za-z0-9_].

regrex question part 2

2003-03-20 Thread David Gilden
In the following why am I getting '23' Is 23 being treated as a string? #!/usr/bin/perl -w use strict; my $s = ' 23 one two three'; $s =~ s/(\w{1,10}).+/$1/; print $s; --- my $s = 'one two three'; $s =~ s/(\w)/$1/; print $s; Returns 'one two three', I was looking for it to match 'on

regrex question

2003-03-20 Thread David Gilden
good afternoon, I am trying to get the following as a result: xxx9988 #!/usr/bin/perl -w $card_number = '123456789988'; $card_number =~ s/\d{8}(\d{4})/x'x'8 . $1/e; # not working print "$card_number\n"; Is there a clever trick using tr =~ or something similar? Thanks! Dave -- To

RE: regrex question

2002-02-18 Thread mark crowe (JIC)
: 16 February 2002 14:07 > To: David Gilden > Cc: [EMAIL PROTECTED] > Subject: Re: regrex question > > > David Gilden wrote: > > > > > $key ="Departure date"; > > > > $key =~ s/([\w\w+])/\u$1/; > > > > > > ---> De

Re: regrex question

2002-02-16 Thread fliptop
David Gilden wrote: > > $key ="Departure date"; > > $key =~ s/([\w\w+])/\u$1/; > > > ---> Desired result: > > Departure Date > > What is wrong the above regrex? it's probably easier to use the ucfirst() function: my $key ="Departure date"; my @result = map { ucfirst } split /\s+/, $key;

regrex question

2002-02-15 Thread David Gilden
$key ="Departure date"; $key =~ s/([\w\w+])/\u$1/; ---> Desired result: Departure Date What is wrong the above regrex? Thanks! Dave ** * Cora Connection Your West African Music Source * * http://www.coraconnection.com/