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
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 output as 1 not a string "test"
'$' mea
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/pvob_aic";
> $ts = ($test =~ m{(.+)@$});
> print "$ts\n";
>
> Bu
-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 I want only "test" from this string, so I wrote reg. ex. like this
>
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
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 =
Here's one example of how you could go about it:
##
use strict;
use warnings;
my $testString = " test_freq = 1.0001;";
print "Test One: ";
if($testString =~ /=\s*([0-9.]+)\s*;\s*$/){
print $1;
}else{
print "Failed!";
}
print "\n";
##
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
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
On Jan 20, 2004, at 4:28 PM, Lewick, Taylor wrote:
Thanks to everyone's help so far, I think I am getting better with
Regular expressions...
Need a little help on this one
This is sample data, not accurate..
1. St Joes (15-0)
.875
(2-0)
2. Kentucky (12-2)
.850
(1-0)
10. Kansas (12-2)
Lewick, Taylor wrote:
Thanks to everyone's help so far, I think I am getting better with
Regular expressions...
Don't know if they have been mentioned, if not:
perldoc perlretut
perldoc perlre
Need a little help on this one
This is sample data, not accurate..
1. St Joes (15-0)
.875
(2-0)
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/;
>
> then we wish to remove the drive designation and the l
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
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
> remove the course number from the end
Is it always at the very end of the string?
If not, then are there any other numbers enclosed in parens in the course
names?
Probably the following should work:
$course =~ s/( \(\d+\)$//;
# removes a space followed by an '(' followed by 1 or more digits, followed
by ')' at the end of the string
F
Hi Melanie
If it's regex you wanna use, here it is :
$fullpath = '/usr/local/home/mel/file.txt';
$fullpath =~ /(.*)\/(.*)\.(.*)/;
$path = $1;
$file = $2;
$ext = $3;
-aman.
-Original Message-
From: Melanie Rouette [mailto:mrouette@;omnisig.com]
Sent: Friday, November 15, 2002 8:49 PM
To
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
39 matches
Mail list logo