Title: Regular expression question
hi
wagner,
try
this:
#/perl
-w
$file =
'c:\temp\zips\foo\foo2\foo3\ok.txt'; @pa = split (/\\/, $file);$file =
$pa[$#pa];
for $i
(0..($#pa-1)) { $dir .=
"$pa[$i]\\"; }
print "directory:
$dir\n";print &
Title: Regular expression question
Cai, Lucy (L.) wrote, on Monday, July 31, 2006 8:21
PM
: My
$file = "c:\temp\zips\ok.txt";
: How can
I split the $file to get the only path:
: My $dir
= "c:\temp\zips"; : My $file = "ok.txt";
May I
suggest you use File:Ba
Title: Regular expression question
From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Cai, Lucy (L.)Sent: Monday, July 31, 2006 17:21To:
Cai, Lucy (L.); perl-win32-users@listserv.ActiveState.com;
perl-unix-users@listserv.ActiveState.com;
[EMAIL PROTECTED];
[EMAIL PROTECTED
Title: Regular expression question
I have a file such as:
My $file = "c:\temp\zips\ok.txt";
How can I split the $file to get the only path:
My $dir = "c:\temp\zips";
My $file = "ok.txt";
Thanks in advance!
Lucy
__
Title: Regular expression question
I have a file such as:
My $file = "c:\temp\zips\ok.txt";
How can I split the $file to get the only path:
My $dir = "c:\temp\zips";
My $file = "ok.txt";
Thanks in advance!
Lucy
__
At 09:45 PM 4/26/2006 -0400, Cai, Lucy \(L.\) wrote:
>return (($Output =~ /.*\(ucmvob\)/s*$/) ? 1 : 0);
>$Output ="/vobs/na_mscs_pvob
>/ccstore/ecc/vobs_fcis321/na_mscs_pvob.vbs public (ucmvob,replicated)"
>
>What I want to do is if this tring include word "ucmvob", then return 1,
>else re
"Cai, Lucy (L.)" <[EMAIL PROTECTED]> graced perl with these words of wisdom:
> return (($Output =~ /.*\(ucmvob\)/s*$/) ? 1 : 0);
>
> }
> **
>
> $Output ="/vobs/na_mscs_pvob
> /ccstore/ecc/vobs_fcis321/na_mscs_pvob.vbs p
Lucy (L.)
Sent: Wednesday, April 26, 2006 6:46 PM
To: perl-win32-users@listserv.ActiveState.com
Cc: perl-win32-users@listserv.ActiveState.com
Subject: Regular expression question
Hi, all,
I have a question about regular expression:
my code is like this:
***
Hi, all,
I have a question about regular expression:
my code is like this:
**
sub IsPVob
{
my ($Vob) = @_;
my $Output = `cleartool lsvob $Vob`;
die "IsPVob can't list vob $Vob" if $?;
return
$Bill Luebkert wrote:
Richard A. Wells wrote:
[...]
The _expression_
$path_elem =~ s{(\s)}{\\$1}gio;
The /io is not needed/wanted.
Right about the /i. That's conventional laziness on my part, as it is
usually what I want, though it would be detrimental in this
Richard A. Wells wrote:
> $Bill Luebkert wrote:
>> Richard A. Wells wrote:
>>
>>> [...]
>>>
>>> The expression
>>>
>>> $path_elem =~ s{(\s)}{\\$1}gio;
>>>
>>
>> The /io is not needed/wanted.
>>
> Right about the /i. That's conventional laziness on my part, as it is
> usually what I w
Richard A. Wells wrote:
> On UNIX you have to escape the whitespace, e.g.
>
> /this path/has spaces
>
> would become
>
> /this\ path/has\ spaces
>
> The expression
>
> $path_elem =~ s{(\s)}{\\$1}gio;
The /io is not needed/wanted.
> should do the trick.
>
> Note that I used {} d
On UNIX you have to escape the whitespace, e.g.
/this path/has spaces
would become
/this\ path/has\ spaces
The expression
$path_elem =~ s{(\s)}{\\$1}gio;
should do the trick.
Note that I used {} delimiters (i.e. s{}{}) to make it clearer, since
the data itself contains /s and som
On UNIX you have to escape the whitespace, e.g.
/this path/has spaces
would become
/this\ path/has\ spaces
The expression
$path_elem =~ s{(\s)}{\\$1}gio;
should do the trick.
Note that I used {} delimiters (i.e. s{}{}) to make it clearer, since
the data itself contains /s and someone might
Hi All,
I am meeting a problem on a regular expression.
My code is like:
$path_elem = "$ENV{'CLEARCASE_PN'}";
The return value of $path_elem is either
$path_elem = /ccstore/test/test.pl
Or $path_elem = /ccstore/test 1/test 1.pl # there is a space in the
path name including the file name too
$Bill Luebkert graced perl with these words of wisdom:
>>>B. I want to get 1.62 from the string, how can I do it?
>>
>>
>> Nobody seems to have answered part B.
>
> Actually they did. Sam's for one :
>
> $string = "sct-1.62-1";
> print "$1\n" if ($string =~ /^.+-(.+)-.+$/);
You mean $1 capt
Ted Schuerzinger wrote:
> Cai, Lixin (L.) graced perl with these words of wisdom:
>
>
>>My $string = "sct-1.62-1";
>>
>>I have 2 regular expression question here,
>>
>>A. I want to check whether the format is "XXX-XXX-XXX", how can I d
Cai, Lixin (L.) graced perl with these words of wisdom:
> My $string = "sct-1.62-1";
>
> I have 2 regular expression question here,
>
> A. I want to check whether the format is "XXX-XXX-XXX", how can I do it?
> B. I want to get 1.62 from the string,
Title: Message
or
even. . .
$string = "sct-1.62-1";print
"$1\n" if ($string =~ /^.+-(.+)-.+$/);
(no
need to use the backslash escape for the dashes; they're not part of a character
class. . .
Sam
Gardner
GTO Application Development
Title: A regular expression question
Your format does not match XXX-XXX-XXX so I'll guess you mean three
fields delimited by a dash.
here's one way to do it
$string = "sct-1.62-1";
print "$1\n" if ($string =~ /^.+\-(.+)\-.+$/)
-Origina
Title: A regular expression question
Now I have a string like
My $string = "sct-1.62-1";
I have 2 regular _expression_ question here,
A. I want to check whether the format is "XXX-XXX-XXX", how can I do it?
B. I want to get 1.62 from the string, how can I do i
Stacy Doss wrote:
$a = "this is a (test)";
$a =~ s/\W+/_/g;
HTH
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, April 01, 2004 11:28 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: regular _expression_ qu
PROTECTED]; [EMAIL PROTECTED]
Subject: RE: regular expression question
Thanks for the replying.
I have another question, if I have a string like
$a = "this is a (test)";
How can I change it to
$a = "this_is_a_test";
How can I remove ()?
Thanks
Lixin
-Original Messa
$a = "this is a (test)";
$a =~ s/\W+/_/g;
HTH
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
[EMAIL PROTECTED]
Sent: Thursday, April 01, 2004 11:28 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: regular expression question
Than
$Bill Luebkert
Sent: Wednesday, March 31, 2004 8:27 PM
To: [EMAIL PROTECTED]
Subject: Re: regular expression question
Wagner, David --- Senior Programmer Analyst --- WGO wrote:
Hey guys - what's with the HTML ?
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> [
Wagner, David --- Senior Programmer Analyst --- WGO wrote:
Hey guys - what's with the HTML ?
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, March 31, 2004 16:49
> To: [EMAIL PROTECTED]
> Subject: regular expression qu
Thanks
Lixin
-Original Message-
From: Todd Hayward [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 12:26 PM
To: [EMAIL PROTECTED]
Subject: Re: regular expression question
Borrowing from the previous example of:
> open(fHandle, "myfile.txt|");
> while (defin
This works:
open (INPUT ,"your_input.txt") || die "$!";
open (OUTPUT, "> your_output.txt") || die "$!";
while () {
if (m/GENERIC_MULTILINE/) {
$_="GENERATION 116
# Impossible dependency
# Needed to prevent FC4700 to CX-series upgrades
DEPEND Navisphere >2.0.0.0.0
DEPEND Navisphere <1.0.0.0.0
GEND
>
> I have another question,
>
> I have string like "> GENERATION 116", How can I get rid of ">", of the
> string?
If you want to remove the 1st character if it is a ">", then use this...
$var =~ s/>//;
$var =~ s/^>//; #This removes it only if it is the first character
___
3 11:58 AM
> To: [EMAIL PROTECTED]
> Subject: RE: regular expression question
>
>
> I have another question,
>
> I have string like "> GENERATION 116", How can I get rid of
> ">", of the
> string?
>
> Thanks
>
> Lixin
>
>
do something}
};
Hope this helps,
NuTs
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 28, 2003 9:40 AM
Subject: regular expression question
> Dear all
>
> I have a txt file like the bottom (I use cleardiff
[EMAIL PROTECTED] schrieb:
> I have a txt file like the bottom (I use cleardiff to
> compare 2 files and
> get this file):
I would recommend that you look at Parse::RecDescent.
Go grab the distribution from CPAN and have a look
at the tutorial - the first example shows you how to
parse a diff.
h
Dear all
I have a txt file like the bottom (I use cleardiff to compare 2 files and
get this file):
I will check whether the line includes "___GENERIC_MULTILINE___" or not, if
it includes, I will get the following information
> GENERATION 116
> # Impossible dependency
> # Needed to prevent FC47
> Net::Telnet, and I want to match several possible strings that would make
up
> the prompts. An explanation below:
>
> '/br[0-9][0-9]/' "or" '/mar[0-9][0-9]/' "or" '/tr[0-9][0-9]/' "or"
> '/ber[0-9]/'
>
One way is:
if($string =~ /(?:b|t|be|ma)r[0-9]{2}/) {
...
}
The operative operator
I am trying to figure out how to specify "or" in a regular expression.
Basically, I am specifying the Prompt portion of a telnet session using
Net::Telnet, and I want to match several possible strings that would make up
the prompts. An explanation below:
'/br[0-9][0-9]/' "or" '/mar[0-9][0-9]/' "o
s [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 19, 2003 6:24 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: an regular expression question
>
>
> On 3/19/2003 6:16 PM, [EMAIL PROTECTED] wrote:
> > All,
> >
> > A question:
> > A f
inal Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 9:28 AM
To: [EMAIL PROTECTED]
Subject: Another regular expression question
Filename = "Base-02.04.1.20.5.002-xlite_katana_free.ndu";
I want to get extension of the file name whic
Hi!
On 20 Mar 2003 at 10:28, [EMAIL PROTECTED] wrote:
> Filename = "Base-02.04.1.20.5.002-xlite_katana_free.ndu";
>
> I want to get extension of the file name which is ndu, but I always
> get 04.1.20.5.002-xlite_katana_free.ndu instead of ndu.
:
Try the code below. i think it works.
Regards,
At 10:28 AM 3/20/2003 -0500, you wrote:
Filename = "Base-02.04.1.20.5.002-xlite_katana_free.ndu";
I want to get extension of the file name which is ndu, but I always get
04.1.20.5.002-xlite_katana_free.ndu instead of ndu.
The sub is like:
sub extension
{
my $path = shift;
my $ext
I want to translate some chaarcters in a
string to its replacement string.
I am doing this.
#**
$inchar =
"\xa2\xa3";$outchar = "\[Cent]\[Pound]";
eval "\$buf =~ tr/$inchar/$outchar/";
#$buf =~ s/$inchar/$outchar/;
print
On Fri, 22 Nov 2002, Stovall, Adrian M. wrote:
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, November 22, 2002 4:38 PM
> > To: Stovall, Adrian M.; [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subj
On Fri, 22 Nov 2002 [EMAIL PROTECTED] wrote:
> all,
>
> I want to check the first line of the file if it is machine or not, like
>
> The first line of the file is:
>
> Job "\nest and \toolbox VOBs" began execution on 9/6/02 at 2:00:11 AM.
>
> my code is like:
>
> if (!-z $file)
> {
> o
Yes, it works fine for me!
Thanks a lot!
Have a nice day.
Lixin
-Original Message-
From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 5:42 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: regular expression question
> -Original Mess
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 22, 2002 4:38 PM
> To: Stovall, Adrian M.; [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: regular expression question
>
>
> I tried that, it does
I tried that, it does not work for me!
Lixin
-Original Message-
From: Stovall, Adrian M. [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 5:28 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: regular expression question
Cai Lixin said:
>
>
> all,
>
Cai Lixin said:
>
>
> all,
>
> I want to check the first line of the file if it is machine
> or not, like
>
> The first line of the file is:
>
> Job "\nest and \toolbox VOBs" began execution on 9/6/02 at 2:00:11 AM.
>
> my code is like:
>
> if (!-z $file)
> {
> open(LOG_FILE, "<
Sorry, I did not state quite clear, if it is machine or not, I want to say
if I it is the right file or not...
Lixin
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 5:07 PM
Cc: [EMAIL PROTECTED]
Subject: regular expression question
all,
I want to check the first line of the file if it is machine or not, like
The first line of the file is:
Job "\nest and \toolbox VOBs" began execution on 9/6/02 at 2:00:11 AM.
my code is like:
if (!-z $file)
{
open(LOG_FILE, "<$file") or warn " can not open $file:$!\n";
while (<>) {
if ( /^#/ ){
print;
}
}
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 3:12 PM
To: [EMAIL PROTECTED];
[EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: A regular expression question
r 12, 2002 3:12 PM
>To: [EMAIL PROTECTED];
>[EMAIL PROTECTED];
>[EMAIL PROTECTED]
>Subject: A regular expression question
>
>
>I have a cron file which the line looks like this:
>
>00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl"
>#bui
Cai_lixin wrote:
> I want to get the comment after # of each line(not including
> "#"), how could I do this?
Depends. If you might have a # in a command, you'll want everything after
the last #. If you're more likely to have another # in a comment, you want
everything after the first #. (if you
At 03:11 PM 9/12/2002 -0400, [EMAIL PROTECTED] wrote:
>I have a cron file which the line looks like this:
>
>00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl"
>#build host scrubber
>30 22 * * * perl -S queue_submit.pl esd-foundry "perl -S group-scrubber.pl"
>#build group s
ROTECTED]]
Sent: Thursday, September 12, 2002 12:12 PM
To: [EMAIL PROTECTED];
[EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: A regular expression question
I have a cron file which the line looks like this:
00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl"
#
[EMAIL PROTECTED] wrote, on Thursday, September 12, 2002 3:12 PM
: I have a cron file which the line looks like this:
:
: 00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl"
: #build host scrubber
: 30 22 * * * perl -S queue_submit.pl esd-foundry "perl -S
: group-scrubber.
Title: RE: A regular expression question
foreach my $line ()
{
my ($comment) = $line =~ /^\#(.*)$/;
}
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 15:12
> To: [EMAIL PROTECTE
I have a cron file which the line looks like this:
00 22 * * * perl -S queue_submit.pl esd-foundry "perl -S host-scrubber.pl"
#build host scrubber
30 22 * * * perl -S queue_submit.pl esd-foundry "perl -S group-scrubber.pl"
#build group scrubber
30 22 * * * perl -S queue_submit.pl esd-foundry "per
Resending because I never saw the message post. Sorry if duplicate.
Try this
#
my $text = "this is a website: www.hello-world.com and an e-mail:
[EMAIL PROTECTED]";
@found = $text =~ m/\s+((?:[\w\d\-\~]{2,}[@|\.](?:[\w\d\-\~]{2,}\.?)+))/g;
print "Fo
Sorry I sent the old version of the regular expression...the correct one is:
m/\s+((?:[\w\d\-\~]{2,}[@|\.](?:[\w\d\-\~]{2,}\.?\@?)+))/g
This one gets stuff like [EMAIL PROTECTED]
Thanks again.
PS..all you web folk out there...stick this under your pillow :) handy
little RegEx..once its working
, Richard E.
Sent: Monday, March 04, 2002 3:32 PM
To: 'Joseph Youngquist'; [EMAIL PROTECTED]
Subject: RE: Regular Expression Question
I think that you may need to do this in a while loop:
my @items
while($text =~ m/your string here/g) {
push @items, $1;
}
print join("\n&
tml.
Thanks for the idea, I'll poke about with it...if no one sends a yes/no to
the question above.
Joe Y.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Jeffrey
Sent: Monday, March 04, 2002 3:51 PM
To: [EMAIL PROTECTED]
Subject: RE: Regular Expression
02:23 PM
To: <[EMAIL PROTECTED]>
cc:
Subject:Regular Expression Question
Hello all, I hope some RegEx guru could answer why this stops once it
finds
the first occurrence of the expression.
m/\s+((?:[\w\d\-\~]{2,}[@|\.](?:[\w\d\-\~]{2,}\.?)+))/g
This is trying
ctory name to be lib/, while dirname() considers the directory name to be
. (dot).
- Original Message -
From: "Carl Campbell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, June 01, 2001 1:05 AM
Subject: RE: regular expression
ECTED]]
Sent: Thursday, May 31, 2001 2:17 PM
To: [EMAIL PROTECTED]
Subject: regular expression question
Dear all,
I have a question about a regular expression, for example
$OK = "c:\\temp\\test\\test1\\test2";
How can I do to make me get
$OK1 = "c:\\temp\\test\\test1";
That
: Thursday, May 31, 2001 5:17 PM
Subject: regular expression question
> Dear all,
> I have a question about a regular expression, for example
> $OK = "c:\\temp\\test\\test1\\test2";
> How can I do to make me get
> $OK1 = "c:\\temp\\test\\test1";
> That means I do no
Of
> [EMAIL PROTECTED]
> Sent: Thursday, May 31, 2001 4:17 PM
> To: [EMAIL PROTECTED]
> Subject: regular expression question
>
>
> Dear all,
> I have a question about a regular expression, for example
> $OK = "c:\\temp\\test\\test1\\test2";
> How can I do to make me
Dear all,
I have a question about a regular expression, for example
$OK = "c:\\temp\\test\\test1\\test2";
How can I do to make me get
$OK1 = "c:\\temp\\test\\test1";
That means I do not want the last part of the directory.
Thanks in advance!
Lixin
___
P
> This works great, but now I need to add an (AND, OR) search ability to my
> search.
$query->{Find} =~ /^(.+?)\s+(and|or)\s+(.+?)$/i;
$sql = "SELECT bla, bla FROM table WHERE column LIKE '$1' $2 '$3'"
Of course you'll have to tweak that so a user doesn't enter something
like
and foo
foo and
(un-jeopardied)
Wagner-David wrote, on Friday, March 02, 2001 13:08
: steve silvers [mailto:[EMAIL PROTECTED]] wrote
: > Say I search on (perl and oracle).
: >
: > if ($query->{Find} =~ /and/i) {
: > Run my sql statement ie: perl and oracle
: > }
: >
: > if ($query->{Find} =~ /or/i) {
: >
steve silvers wrote:
> I'm calling a bunch of rows from my database.
> In the while loop.
>
> while(my $Dataref = $sth->fetchrow_hashref) {
>my %Data = %{$Dataref};
>my $text = ($Data{val});
>
> $text = (/(www\.[\w\.\-\/\&\=\+\%\:\?]*[a-zA-Z\/0-9])[\001\074]*/)
>
Im calling a bunch of rows from my database.
In the while loop.
while(my $Dataref = $sth->fetchrow_hashref) {
my %Data = %{$Dataref};
my $text = ($Data{val});
$text = (/(www\.[\w\.\-\/\&\=\+\%\:\?]*[a-zA-Z\/0-9])[\001\074]*/)
$emailaddress = $1;
print
> I am curious, why does this exact same question keep showing up, from
> different people (I believe) and with a spaced regularity over and over
> again?
I don't know, but you are right.
The most FAQ is : How to send attachments?
The second place is reserved to: How to fetch rows?
The third : Ho
71 matches
Mail list logo