On Wed, Apr 16, 2008 at 12:31:36AM +0100, Rob Dixon wrote:
> Paul Johnson wrote:
> > On Tue, Apr 15, 2008 at 08:38:30PM +0100, Rob Dixon wrote:
> >> Paul Johnson wrote:
> >>> On Wed, Apr 16, 2008 at 12:11:20AM +0530, [EMAIL PROTECTED] wrote:
> >>>
> I need help in regular expression. I have st
Paul Johnson wrote:
> On Tue, Apr 15, 2008 at 08:38:30PM +0100, Rob Dixon wrote:
>> Paul Johnson wrote:
>>> On Wed, Apr 16, 2008 at 12:11:20AM +0530, [EMAIL PROTECTED] wrote:
>>>
I need help in regular expression. I have string as follows.
OMS.FD.08.03.000.14
I need only OM
On Tue, Apr 15, 2008 at 08:38:30PM +0100, Rob Dixon wrote:
> Paul Johnson wrote:
> >
> > On Wed, Apr 16, 2008 at 12:11:20AM +0530, [EMAIL PROTECTED] wrote:
> >
> >> I need help in regular expression. I have string as follows.
> >>
> >> OMS.FD.08.03.000.14
> >>
> >> I need only OMS.FD.08.03.000 thi
Paul Johnson wrote:
>
> On Wed, Apr 16, 2008 at 12:11:20AM +0530, [EMAIL PROTECTED] wrote:
>
>> I need help in regular expression. I have string as follows.
>>
>> OMS.FD.08.03.000.14
>>
>> I need only OMS.FD.08.03.000 this much part of the string.i want to
>> exclude .14
>
> That's not much of a
On Wed, Apr 16, 2008 at 12:11:20AM +0530, [EMAIL PROTECTED] wrote:
> Hi All,
Hello
> I need help in regular expression. I have string as follows.
>
> OMS.FD.08.03.000.14
>
> I need only OMS.FD.08.03.000 this much part of the string.i want to
> exclude .14
>
> Please help.
That's not much of
Hi All,
I need help in regular expression. I have string as follows.
OMS.FD.08.03.000.14
I need only OMS.FD.08.03.000 this much part of the string.i want to
exclude .14
Please help.
Regards,
Irfan
<[EMAIL PROTECTED]> wrote:
> ok, I found my error, it should be as follows if I want to
> match number 6:- my $_ = 62; if( $_ =~ /^6$/){
Of course you could also just use "if( $_ == 6 )".
HTH,
Thomas
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED
ok, I found my error, it should be as follows if I want to match number 6:-
my $_ = 62; if( $_ =~ /^6$/){
- Original Message -
From: <[EMAIL PROTECTED]>
To:
Sent: Wednesday, April 02, 2008 5:07 PM
Subject: simple reg ex matching
Hi,
The value of $_ is 62. In the script below,
Hi,
The value of $_ is 62. In the script below, I just wonder why the default
variable match the number 6. What I wanted to say is that if the default
variable $_ holding the value of 62, if match the number 6, then print Yes
match. So what is the right way to right.
Thanks
use strict;
use warn
Chas. Owens wrote:
A regex in scalar context returns a 1 if it matches and a 0 if it
doesn't.
Not quite. A failed regex match returns the null string '', not a zero
value. It is of course still false for boolean tests.
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
On Dec 20, 2007 5:27 AM, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
snip
> $ts = ($test =~ m{(.+)\@/});
snip
> but again the same output. I am not getting output as "test"
snip
That is because you are still putting the regex in scalar context
instead of list context. A regex in scalar contex
Pang [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 20, 2007 2:31 PM
To: Sayed, Irfan (Irfan); beginners @ perl. org
Subject: Re: reg. ex.
-Original Message-
>From: "Sayed, Irfan (Irfan)" <[EMAIL PROTECTED]>
>Sent: Dec 20, 2007 4:53 PM
>To: "beginners @ per
On Dec 20, 2007 4:37 AM, Gunnar Hjalmarsson <[EMAIL PROTECTED]> wrote:
snip
> >> $ts = ($test =~ m{(.+)@$});
snip
> > '$' means end of a line,
>
> Obviously not in this case, since the regex returns 1 in scalar context
> (i.e. it matches).
snip
It is returning 1 because it is in scalar context, @$
Jeff Pang wrote:
Sayed, Irfan (Irfan) wrote:
Now I want only "test" from this string, so I wrote reg. ex. like this
Missing:
use strict;
use warnings;
$test="test@/vobs/pvob_aic";
$ts = ($test =~ m{(.+)@$});
print "$ts\n";
But I am getting
On Dec 20, 2007 3:53 AM, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have one string like this "test@/vobs/pvob_aic";
>
> Now I want only "test" from this string, so I wrote reg. ex. like this
>
> $test="test@/vobs/pvo
-Original Message-
>From: "Sayed, Irfan (Irfan)" <[EMAIL PROTECTED]>
>Sent: Dec 20, 2007 4:53 PM
>To: "beginners @ perl. org"
>Subject: reg. ex.
>
>Hi All,
>
>I have one string like this "test@/vobs/pvob_aic";
>
>Now
Hi All,
I have one string like this "test@/vobs/pvob_aic";
Now I want only "test" from this string, so I wrote reg. ex. like this
$test="test@/vobs/pvob_aic";
$ts = ($test =~ m{(.+)@$});
print "$ts\n";
But I am getting output as 1 not a string &quo
On Fri, 04 Aug 2006 10:26:16 +0100, Paul Beckett wrote:
> I'm trying to pattern match the beginning of a SQL string like:
> INSERT INTO `rwikiobject` VALUES
> ('0b5e02f308c5341d0108fca900670107','2006-03-06
> 23:36:41','/site/ec07580d-1c66-469f-80be-c0afd616cedf/alembert, d
> \'','/site/ec07580d-1c
On 08/04/2006 04:26 AM, Paul Beckett wrote:
I'm trying to pattern match the beginning of a SQL string like:
INSERT INTO `rwikiobject` VALUES
('0b5e02f308c5341d0108fca900670107','2006-03-06
23:36:41','/site/ec07580d-1c66-469f-80be-c0afd616cedf/alembert, d
\'','/site/ec07580d-1c66-469f-80be-c0afd61
warning though - definately a command to be very careful with.
Many thanks to Rob as well, the eval solution works nicely.
Cheers,
Paul
-Original Message-
From: [EMAIL PROTECTED] on behalf of Tom Phoenix
Sent: Fri 8/4/2006 4:51 PM
To: Rob Dixon
Cc: beginners@perl.org
Subject: Re: reg-ex match
On 8/4/06, Rob Dixon <[EMAIL PROTECTED]> wrote:
The code below grabs the contents of the SQL string between (and
including) the first '(' and the last ')'. It then calls eval() to process it
Please don't use the evil eval for this. You're using a flamethrower
to light candles. Slip the string
Paul Beckett wrote:
>
> I'm trying to pattern match the beginning of a SQL string like:
> INSERT INTO `rwikiobject` VALUES
> ('0b5e02f308c5341d0108fca900670107','2006-03-06
> 23:36:41','/site/ec07580d-1c66-469f-80be-c0afd616cedf/alembert, d
> \'','/site/ec07580d-1c66-469f-80be-c0afd616cedf'
>
> My
I'm trying to pattern match the beginning of a SQL string like:
INSERT INTO `rwikiobject` VALUES
('0b5e02f308c5341d0108fca900670107','2006-03-06
23:36:41','/site/ec07580d-1c66-469f-80be-c0afd616cedf/alembert, d
\'','/site/ec07580d-1c66-469f-80be-c0afd616cedf'
My expression so far looks like:
my ($
thanks for the help, that did the trick
On 6/27/06, Ryan Moszynski <[EMAIL PROTECTED]> wrote:
i have this string extracted from a text file i'm writing a program to process:
test_freq = 1.0001;
and i have to extract the "1.0001"
i can't count on the whitspace being where it now is.
I wo
Ryan Moszynski wrote:
i have this string extracted from a text file i'm writing a program to
process:
test_freq = 1.0001;
and i have to extract the "1.0001"
i can't count on the whitspace being where it now is.
I would like to change this line of perl
$getTestFRQ =~ s/\D+//g;
so that
"Ryan Moszynski" schreef:
> i have this string extracted from a text file i'm writing a program
> to process:
>
> test_freq = 1.0001;
>
> and i have to extract the "1.0001"
>
> i can't count on the whitspace being where it now is.
>
> I would like to change this line of perl
>
> $getTestFRQ =
atch only a
number that is a n rvalue.
-Original Message-
From: Ryan Moszynski [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 27, 2006 1:27 PM
To: beginners@perl.org
Subject: reg ex problem
i have this string extracted from a text file i'm writing a program to
process:
test_freq
Ryan Moszynski wrote:
> i have this string extracted from a text file i'm writing a program
> to process:
>
> test_freq = 1.0001;
>
> and i have to extract the "1.0001"
>
> i can't count on the whitspace being where it now is.
>
> I would like to change this line of perl
>
> $getTestFRQ
i have this string extracted from a text file i'm writing a program to process:
test_freq = 1.0001;
and i have to extract the "1.0001"
i can't count on the whitspace being where it now is.
I would like to change this line of perl
$getTestFRQ =~ s/\D+//g;
so that instead of killing all no
Ajey Kulkarni wrote:
Thanks a ton Gunnar,
How about the intermediate blanks? Is there a way to recursively
take all blanks/tabs that occur??
word=Detail Design Activity Included#
I would like to remove the blanks here..
Recursion is not required.
$word =~ tr/ \t//d;
John
--
use Perl;
program
fulfil
Ajey Kulkarni wrote:
#snippet to replace all the ,, with ,NEW,
my($word) = " Detail Design Activity Included ,-1,0
,hello,ajey ";
$word =~ s/\s+//g;
$word =~ s/,,/,NEW,/gc;
The /c modifier is redundant, which Perl would have told you if warnings
had been enabled. :(
Ple
One more extension to this qn.
#snippet to replace all the ,, with ,NEW,
my($word) = " Detail Design Activity Included ,-1,0
,hello,ajey ";
$word =~ s/\s+//g;
$word =~ s/,,/,NEW,/gc;
printf "word=$word#\n";
after removing the blanks ,if there are any ",," i would like
Ajey Kulkarni wrote:
Gunnar Hjalmarsson wrote:
Ajey Kulkarni wrote:
I would like to remove all the spaces & tabs from a variable.
No, you wouldn't. You would like to remove possible whitespace from
the beginning and end of a string.
my($word) = " Detail Design Activity Included ";
$word =
Thanks a ton Gunnar,
How about the intermediate blanks? Is there a way to recursively
take all blanks/tabs that occur??
word=Detail Design Activity Included#
I would like to remove the blanks here..
TIA
-Ajey
On Sun, 17 Oct 2004, Gunnar Hjalmarsson wrote:
> Ajey Kulkarni wrote:
> > I would lik
Ajey Kulkarni wrote:
I would like to remove all the spaces & tabs from a variable.
No, you wouldn't. You would like to remove possible whitespace from the
beginning and end of a string.
my($word) = " Detail Design Activity Included ";
$word =~ s/^\s*(\D*)\s*$/$1/;
It's best done using t
Howdy,
I would like to remove all the spaces & tabs from a variable.
my($word) = " Detail Design Activity Included ";
$word =~ s/^\s*(\D*)\s*$/$1/;
printf "word=$word#\n";
word=Detail Design Activity Included#
the above stuff is the output and i'm stil not able to get
the
(12-2)
.778
(1-1)
198 Crappy School (2-9)
.233
and on and on..
I am trying to match only the schools name, and I have the following
reg
ex
if (/^\d\.\s([A-Z]\D+)/) (This says match starting at the beginning of
the line a digit followed by a period followed by a space followed by a
Ca
.875
(2-0)
2. Kentucky (12-2)
.850
(1-0)
10. Kansas (12-2)
.778
(1-1)
198 Crappy School (2-9)
Note: there is not (.) after 198... is your data sane?
.233
I think I went to Crappy School, good parties... ;-)
and on and on..
I am trying to match only the schools name, and I have the fol
.233
and on and on..
I am trying to match only the schools name, and I have the following reg
ex
if (/^\d\.\s([A-Z]\D+)/) (This says match starting at the beginning of
the line a digit followed by a period followed by a space followed by a
Capital letter followed by any amount of nondigit chara
Thanks Wags, terrific.
Colin
"Wagner, David --- Senior Programmer Analyst --- WGO"
<[EMAIL PROTECTED]>
13/01/2004 12:03 PM
To: Colin Johnstone/Australia/Contr/[EMAIL PROTECTED], <[EMAIL PROTECTED]>
cc:
Subject:RE: Reg ex help
Colin Johnstone wrote:
> Gidday list,
>
> Please I need a reg ex to return everything to the left of '\WORKAREA'
>
> in this URL
>
> $url = 'Y:\default\main\aphrwebAdmin\WORKAREA\Colin'
>
> I tried
>
> $url =~ s/(.*?)[\\WORKAREA]/$1/;
>
Gidday list,
Please I need a reg ex to return everything to the left of '\WORKAREA'
in this URL
$url = 'Y:\default\main\aphrwebAdmin\WORKAREA\Colin'
I tried
$url =~ s/(.*?)[\\WORKAREA]/$1/;
then we wish to remove the drive designation and the leading slash
Thanking
Mike wrote:
Given the following code snippet:
-
print "$text\n";
my $text="sour red apples";
my $pattern="(sour)";
my $replacement="very \$1";
$text=~s/$pattern/$replacement/;
print "$text\n";
-
I was expecting "very sour red appl
ent: 6/26/03 12:38 PM
Subject: HELP! Reg-ex question
Given the following code snippet:
-
print "$text\n";
my $text="sour red apples";
my $pattern="(sour)";
my $replacement="very \$1";
$text=~s/$pattern/$replacement/;
pr
Given the following code snippet:
-
print "$text\n";
my $text="sour red apples";
my $pattern="(sour)";
my $replacement="very \$1";
$text=~s/$pattern/$replacement/;
print "$text\n";
-
I was expecting "very sour red apples" to be pr
On Fri, 7 Mar 2003 09:29:25 -0600 , Jensen Kenneth B SrA AFPC/DPDMPQ <[EMAIL
PROTECTED]> wrote:
> Perldoc's aren't available on our systems. Guessing they were not part of
> perl4, or were not installed when perl4 was installed. Are the perldocs
>
1 PM
To: Jensen Kenneth B SrA AFPC/DPDMPQ
Cc: [EMAIL PROTECTED]
Subject: Re: Commands inside a reg-ex substitution problems
Jensen Kenneth B SrA AFPC/DPDMPQ wrote:
>
>
The use of quotes may be useless, but it's just more
> aesthetically appealing to me. I doubt they really effe
Jensen Kenneth B Sra Afpc/Dpdmpq wrote:
> >
> >$_spath =~ s{^\.}
> >{ $path = `pwd`;
> > chop $path;
> > $path
> >}e;
>
> I wasn't aware I could have multiple commands in there. Had to change it
> around so perl4 would be happy, no white space and
"Scott R. Godin" wrote:
>
> John W. Krahn wrote:
>
> >> ($_pattern, $_start) = (shift, shift);
> >> print "Starting search at: $_start\n";
> >>
> >> chdir "$_start";
> >
> > Useless use of quotes. You should verify that chdir worked.
> >
> > unless ( chdir $_start ) {
> > print STDERR "Canno
Jensen Kenneth B SrA AFPC/DPDMPQ wrote:
The use of quotes may be useless, but it's just more
aesthetically appealing to me. I doubt they really effect processing speed
by any measurable amount anyway :).
As just posted, the quotes affect more than speed...
perldoc -q "wrong with always quotin
>Jensen Kenneth B Sra Afpc/Dpdmpq wrote:
>>
>> Trying to get this to work on one line, but not having any success. In
>> my boredom I re-wrote the find command using perl4, and in tweaking it
>> I'm running into a problem. When I type in a starting search path as
>> "./something/something"
From: "Scott R. Godin" <[EMAIL PROTECTED]>
> John W. Krahn wrote:
> > unless ( opendir( DIR, $_start ) ) {
> > print STDERR "Cannot open $_start: $!";
> > exit 1;
> > }
>
> die "Cannot open directory $_start: $!"
> unless opendir(DIR, $_start);
Just FYI these two are not equiv
John W. Krahn wrote:
>> ($_pattern, $_start) = (shift, shift);
>> print "Starting search at: $_start\n";
>>
>> chdir "$_start";
>
> Useless use of quotes. You should verify that chdir worked.
>
> unless ( chdir $_start ) {
> print STDERR "Cannot chdir to $_start: $!";
> exit 1;
> }
Jensen Kenneth B Sra Afpc/Dpdmpq wrote:
>
> Trying to get this to work on one line, but not having any success. In my
> boredom I re-wrote the find command using perl4, and in tweaking it I'm
> running into a problem. When I type in a starting search path as
> "./something/something" I want to re
Trying to get this to work on one line, but not having any success. In my
boredom I re-wrote the find command using perl4, and in tweaking it I'm
running into a problem. When I type in a starting search path as
"./something/something" I want to replace the "." with the current working
directory. S
On Mon, 24 Feb 2003, Colin Johnstone wrote:
> Gidday all,
>
> >From this string I wish to return everything to the left of the last
> occurence of "." if it exists.
>
> string = "3.25.23.4";
my $string = "3.25.23.4";
my $ret = '';
$ret = $1 if ($string =~ /^(.*)\./);
print "$ret";
This will p
Gidday all,
>From this string I wish to return everything to the left of the last
occurence of "." if it exists.
string = "3.25.23.4";
Any help appreciated
Thank You
Colin
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi Colin
You may prefer this:
$line =~ s/[\d\s()]+$//g;
which will remove all trailing whitespace, digits and parentheses from
string $line.
Rob
"Colin Johnstone" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Gidday All,
>
> Im reading course names in
Thank You Toby and Mark for your help
Colin Johnstone
Website Project Officer
Corporate Website Unit
Public Affairs Directorate
ph 9561 8643
> -Original Message-
> From: Johnstone, Colin [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 20, 2002 11:55 AM
> To: '[EMAIL PROTECTED]'
> Subject: Reg ex help!
>
>
> Gidday All,
>
> Im reading course names in from a text file and want to
he end of the string
Feel free to adapt as needed.
/\/\ark
-Original Message-
From: Johnstone, Colin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 4:55 PM
To: '[EMAIL PROTECTED]'
Subject: Reg ex help!
Gidday All,
Im reading course names i
Gidday All,
Im reading course names in from a text file and want to remove the course number from
the end of each course name. Can someone help me with the regex to do this.
e.g Mathematics 2 unit (15240)
to give me Mathematics 2 unit
Thanking you in anticipation.
Colin Johnstone
Webs
5, 2002 8:49 PM
To: beginners
Subject: reg ex question
Hi,
I have something like: /usr/local/home/mel/file.txt and I'd like to
strip it so that I can put the path in a variable, the file name in
another one and the extention in a another one as well. How do I do
that, can I do it all
On Fri, 15 Nov 2002, Melanie Rouette wrote:
> Hi,
> I have something like: /usr/local/home/mel/file.txt and I'd like to
> strip it so that I can put the path in a variable, the file name in
> another one and the extention in a another one as well. How do I do
> that, can I do it all in a same e
Hi,
I have something like: /usr/local/home/mel/file.txt and I'd like to
strip it so that I can put the path in a variable, the file name in
another one and the extention in a another one as well. How do I do
that, can I do it all in a same expression. Something like, $path =
/usr/local/home/me
-Original Message-
From: David Mamanakis [mailto:efialtis@;efialtis.com]
Sent: Friday, October 18, 2002 4:37 PM
To: [EMAIL PROTECTED]
Subject: another reg-ex question
these are common it seems...
I have a routine that returns a listing of users and all their information
in a list format in an
problem I am having is I need to know how to grab individual components
out of the listing...
Each list is an element in the array.
I can grab each list doing a "foreach" but I need a reg-ex to grab only the
username or only the phone number...
Earlier reg-ex's I have written I have
67 matches
Mail list logo