Re: regex problem?

2015-11-25 Thread Shawn H Corey
On Wed, 25 Nov 2015 17:22:04 + Andrew Solomon wrote: > The only problem I can see is that you want UPPERCASE-1234 and your > regex has lowercase. Try > > (\A[A-Z]+) # match and capture leading alphabetics Please put the anchor outside the capture. And you could use the POSIX conventions:

Re: regex problem?

2015-11-25 Thread Andrew Solomon
The only problem I can see is that you want UPPERCASE-1234 and your regex has lowercase. Try (\A[A-Z]+) # match and capture leading alphabetics Andrew p.s Why not add "use strict; use warnings", "my $var;" and wear a seat belt when you're driving?:) On Wed, Nov 25, 2015 at 5:09 PM, Rick T

RE: regex problem

2010-11-05 Thread Ken Slater
>From: jm [mailto:jm5...@gmail.com] >Sent: Friday, November 05, 2010 10:21 AM > >i appreciate the tips. unfortunately, adding modules to this server >is not currently possible. does anyone have a more 'hands-on' >solution? Take a look at the Text::ParseWords module. I believe it should be insta

Re: regex problem

2010-11-05 Thread jm
i appreciate the tips. unfortunately, adding modules to this server is not currently possible. does anyone have a more 'hands-on' solution? On Fri, Nov 5, 2010 at 8:53 AM, Shawn H Corey wrote: > On 10-11-05 09:34 AM, jm wrote: >> >> i have csv files in the following format, where some fields a

Re: regex problem

2010-11-05 Thread Robert Wohlfarth
On Fri, Nov 5, 2010 at 8:34 AM, jm wrote: > changing the formatting of the source file to enclose all fields in > double quotes is not an option. i'm trying to figure out a regex, > split, or some other functionality that will allow me to either > > 1. wrap each 'bare' field in double quotes (ig

Re: regex problem

2010-11-05 Thread Shawn H Corey
On 10-11-05 09:34 AM, jm wrote: i have csv files in the following format, where some fields are enclosed in double quotes if they have commas embedded in them and all other fields are simply comma-delimited without any encapsulation The best way to deal with CSV is to use a module from CPAN. T

Re: Regex problem

2009-12-26 Thread Chris Charley
- Original Message - From: "Owen" Newsgroups: perl.beginners Hello Owen To check the date passed with a script, I first check that the date is in the format 20dd (20 followed by 6 digits exactly) But the regex is wrong, tried /^20\d{6}/,/^20\d{6,6}?/,/^20\d{6,}?/ and while a

Re: Regex problem

2009-12-21 Thread Robert Wohlfarth
On Mon, Dec 21, 2009 at 9:11 AM, jbl wrote: > The desired output would be > 91416722243rd St > > I am getting this as output > > 91416722rd St <- just the rd St > > > while ( defined ( my $line = ) ) { > $line =~ s/(\s)243 /$1243rd /g; > print MY_OUTPUT_FILE $line; > } > T

Re: Regex problem

2009-12-21 Thread Shawn H Corey
jbl wrote: > I have a lengthy list of data that I read in. I have substituted a one > line example using __DATA__. > The desired output would be > 91416722 243rd St > > I am getting this as output > > 91416722rd St <- just the rd St > > The capturing reference on (\s)..$1 > > is

Re: Regex problem, #.*# on new line

2009-03-11 Thread John W. Krahn
Brent Clark wrote: Hiya Hello, I got a string like so, and for the likes of me I can get regex to have it that each line is starts with #abc#. my $a = "#aaa#message:details;extra:info;variable:times;#bbb#message:details;extra:info;variable:times;#ccc#not:always;the:same;ts:14:00.00;"; $

Re: Regex problem

2009-03-11 Thread Chas. Owens
On Wed, Mar 11, 2009 at 12:53, howa wrote: > Hello, > > On Mar 12, 12:34 am, jimsgib...@gmail.com (Jim Gibson) wrote: >> That will test if $a starts with 'html' or 'jpg'. To test for a non-match, >> use the !~ operator: >> > > I can't, since I will add more criteria into the regex, > > e.g. > > I

Re: Regex problem

2009-03-11 Thread howa
Hello, On Mar 12, 12:34 am, jimsgib...@gmail.com (Jim Gibson) wrote: > That will test if $a starts with 'html' or 'jpg'. To test for a non-match, > use the !~ operator: > I can't, since I will add more criteria into the regex, e.g. I need to match a.* , except a.html or a.jpg if ( $a =~ /a\.(

Re: Regex problem

2009-03-11 Thread Jim Gibson
On 3/10/09 Tue Mar 10, 2009 8:41 PM, "howa" scribbled: > Hi, > > On Mar 11, 1:16 am, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote: >> >> I would do: >> >>      if ( $a =~ /\.(?:html|jpg)$/i ) >> >> Please readhttp://perldoc.perl.org/perlretut.htmland other appropriate >> docs. > > Read the

Re: Regex problem

2009-03-11 Thread howa
Hi, On Mar 11, 1:16 am, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote: > > I would do: > >      if ( $a =~ /\.(?:html|jpg)$/i ) > > Please readhttp://perldoc.perl.org/perlretut.htmland other appropriate > docs. Read the doc, but how to negate the "Non-capturing groupings" ? use strict; my $a = '

Re: Regex problem

2009-03-10 Thread Gunnar Hjalmarsson
howa wrote: Hello, Consider the code: #=== use strict; my $a = 'a.jpg'; if ($a =~ /(html|jpg)/gi) { print 'ok'; } #=== Is the brucket "()" must be needed? Parentheses. What happened when you tried without them? And why the /g modifier? Since I am n

Re: Regex problem

2009-03-10 Thread Chas. Owens
On Tue, Mar 10, 2009 at 11:19, howa wrote: > Hello, > > Consider the code: > #=== > > use strict; > > my $a = 'a.jpg'; > > if ($a =~ /(html|jpg)/gi) { >    print 'ok'; > } > > #=== > > > Is the brucket "()" must be needed? Since I am not using back > reference, are

Re: Regex problem

2009-03-10 Thread Jim Gibson
On 3/10/09 Tue Mar 10, 2009 8:19 AM, "howa" scribbled: > Hello, > > Consider the code: > #=== > > use strict; > > my $a = 'a.jpg'; > > if ($a =~ /(html|jpg)/gi) { > print 'ok'; > } > > #=== > > > Is the brucket "()" must be needed? Since I am not using

Re: Regex problem with accented characters

2007-03-27 Thread Rob Dixon
Beginner wrote: /^(\w{2})\s+(\w+\s\w+\s\w+s\w+|\w+\s\w+\s\w+|\w+\s\w+|\w+)/); It's worth noting that this could be written: /^(\w{2})\s+(\w+(?:\s\w+)*)/); Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Regex problem with accented characters

2007-03-27 Thread Rob Dixon
Beginner wrote: Hi, I am trying to extract the iso code and country name from a 3 column table (taken from en.wikipedia.org) and have noticed a problem with accented characters such as Ô. Below is my script and a sample of the data I am using. When I run the script the code beginning CI for

Re: Regex problem with accented characters

2007-03-27 Thread Mumia W.
On 03/27/2007 03:34 AM, Beginner wrote: Hi, I am trying to extract the iso code and country name from a 3 column table (taken from en.wikipedia.org) and have noticed a problem with accented characters such as Ô. Below is my script and a sample of the data I am using. When I run the script t

Re: regex problem

2006-02-16 Thread Jay Savage
On 2/15/06, anand kumar <[EMAIL PROTECTED]> wrote: > > > "John W. Krahn" <[EMAIL PROTECTED]> wrote:anand kumar wrote: > > Hi all, > > Hello, > > > I have the following problem in the following regex replace. > > > > $line=~s!\b($name)\b!$1!g; > > > > here this regex finds the exact matching of

Re: regex problem

2006-02-15 Thread anand kumar
"John W. Krahn" <[EMAIL PROTECTED]> wrote:anand kumar wrote: > Hi all, Hello, > I have the following problem in the following regex replace. > > $line=~s!\b($name)\b!$1!g; > > here this regex finds the exact matching of the content in $name and does > the needed but in some examples the v

Re: regex problem

2006-02-14 Thread John W. Krahn
anand kumar wrote: > Hi all, Hello, > I have the following problem in the following regex replace. > > $line=~s!\b($name)\b!$1!g; > > here this regex finds the exact matching of the content in $name and does > the needed but in some examples the variable $name may contain backslash > characters

Re: regex problem

2005-07-01 Thread Jay Savage
On 7/1/05, Moon, John <[EMAIL PROTECTED]> wrote: > The following is not returning what I had expected... > > SUN1-BATCH>perl -e '$a=q{/var/run}; $home=q{/var/123};print "Yes - $a like > $home\n" if $a =~ /^$home/;' > SUN1-BATCH>perl -e '$a=q{/var/run}; $home=q{/var/ra};print "Yes - $a like > $home

Re: regex problem

2005-07-01 Thread Ing. Branislav Gerzo
Moon, John [MJ], on Friday, July 1, 2005 at 11:30 (-0400 ) contributed this to our collective wisdom: MJ> I would have "assumed" that /var/run would NOT be "like" /var/ru just as MJ> /var/run is not "like" /var/ra... is "/var/ru" at the beginning of "/var/run" ? yes. -- ...m8s, cu l8r, Brano

Re: regex problem

2005-07-01 Thread Chris Devers
On Fri, 1 Jul 2005, Moon, John wrote: > The following is not returning what I had expected... > > $a= q{/var/run}; > $home = q{/var/ru}; > print "Yes - $a like $home\n" if $a =~ /^$home/; > > I would have "assumed" that /var/run would NOT be "like" /var/ru just > as /var/run is not "like"

RE: regex problem

2004-08-10 Thread Chris Devers
On Tue, 10 Aug 2004 [EMAIL PROTECTED] wrote: So Data::Dumper shows me a structure of any scaler? Could you show me an example? Data::Dumper is a tool for showing the structure of *any* data. As is often the case, the perldoc has some of the best documentation: perldoc Data::Dumper It starts o

RE: regex problem

2004-08-10 Thread DBSMITH
09/2004 06:31 PM To: <[EMAIL PROTECTED]> cc: <[EMAIL PROTECTED]> Subject:RE: regex problem [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote: : it is a system app call that populates the : $EDM_nonactive_tapelist I am not sure what you m

RE: regex problem

2004-08-09 Thread Charles K. Clarkson
[EMAIL PROTECTED] wrote: : it is a system app call that populates the : $EDM_nonactive_tapelist I am not sure what you mean : "I'm not sure. "has the Orig strings in it" is not a : precise statement for a computer programmer." I meant that "has the Orig strings in

RE: regex problem

2004-08-09 Thread DBSMITH
ings in it ! the foreach with the split did work! thanks! Derek B. Smith OhioHealth IT UNIX / TSM / EDM Teams "Charles K. Clarkson" <[EMAIL PROTECTED]> 08/09/2004 05:41 PM To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> cc: Subject:

RE: regex problem

2004-08-09 Thread Charles K. Clarkson
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : All I am getting the error from my if statement: : : ^* matches null string many times in regex; marked by <-- : HERE in m/^* <-- : HERE Orig/ at . : : I am trying to get everything except *Orig in this output : : : *Orig Vol: 1703FBBDED58D4AD (E00

Re: regex problem

2004-08-09 Thread DBSMITH
TECTED]> cc: Subject: Re: regex problem perhaps you meant "^\* ... rather than "\^\* ... the later will trap things beginning with "^*" ... - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, August 09, 20

Re: regex problem

2004-08-09 Thread Gunnar Hjalmarsson
[EMAIL PROTECTED] wrote: All I am getting the error from my if statement: ^* matches null string many times in regex; marked by <-- HERE in m/^* <-- HERE Orig/ at . I am trying to get everything except *Orig in this output : Here is my code: foreach ($EDM_nonactive_tapelist) { if

RE: REGEX PROBLEM (fwd)

2003-07-25 Thread magelord
--- Begin Message --- Hi A way to solve your problem is to use the FILE module and take the filename out using basename. I think BaseName.pm can be downloaded form CPAN. Please try the following: use File::Basename; @filenames = qw (/tmp/test/.test.txt /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /va

Re: REGEX PROBLEM

2003-07-25 Thread Rob Dixon
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > hi, i have the follwing strings: > > > /tmp/test/.test.txt > /tmp/test/hallo.txt > /tmp/test/xyz/abc.txt > /var/log/ksy/123.log > > > now i need a regex that matches all lines but the one that contains a > filename starting with a point

Re: REGEX PROBLEM

2003-07-25 Thread Kino
On Friday, Jul 25, 2003, at 18:09 Asia/Tokyo, [EMAIL PROTECTED] wrote: /tmp/test/.test.txt /tmp/test/hallo.txt /tmp/test/xyz/abc.txt /var/log/ksy/123.log now i need a regex that matches all lines but the one that contains a filename starting with a point. like ".test.txt". how can i do that? this

Re: regex problem

2003-07-24 Thread LI NGOK LAM
> > I have a number $page = 500; > now i want to check that if $page matches a word character then make $page > =1; $page = 1 unless ( $page =~ /\d/ ); or $page = 1 if ($page =~ /\D/ ); > so originally i did this > my $page =500; > if(($page =~ /\w/) || ($page <= 0)){ > $page=1; > } > print"$pag

Re: regex problem

2003-07-24 Thread Sudarshan Raghavan
awarsd wrote: Hi, I have a number $page = 500; now i want to check that if $page matches a word character then make $page =1; so originally i did this my $page =500; if(($page =~ /\w/) || ($page <= 0)){ $page=1; } print"$page"; since it always returns $page = 1; then i did this if(($page =~ /(\w)

RE: Regex problem

2003-06-25 Thread Dan Muey
; to be > > my $string = 'I love c\++'; > > it runs, but, you also get this output : > > C:\SCRIPTS\test>perl lovec.pl > some compare string does not contain I love c\++ > > DerekB > > -Original Message- > From: John W. Krahn [mailto:[EMAIL

Re: Regex problem

2003-06-25 Thread Beau E. Cox
- Original Message - From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> To: "Beau E. Cox" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, June 25, 2003 8:45 AM Subject: Re: Regex problem > On Jun 25, Beau E. Cox said: >

RE: Regex problem

2003-06-25 Thread Derek Byrne
: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: 25 June 2003 20:03 To: [EMAIL PROTECTED] Subject: Re: Regex problem "Beau E. Cox" wrote: > > Hi All - Hello, > This script: > > use strict; > use warnings; > > my $string = 'I love c++'; > my $compa

Re: Regex problem

2003-06-25 Thread John W. Krahn
"Beau E. Cox" wrote: > > Hi All - Hello, > This script: > > use strict; > use warnings; > > my $string = 'I love c++'; > my $compare = 'some compare string'; > if ($compare =~ /$string/) { > print "$compare contains $string\n"; > } else { > print "$compare does not contain $string\n";

Re: Regex problem

2003-06-25 Thread Jeff 'japhy' Pinyan
On Jun 25, Beau E. Cox said: >my $string = 'I love c++'; >my $compare = 'some compare string'; >if ($compare =~ /$string/) { >print "$compare contains $string\n"; >} else { >print "$compare does not contain $string\n"; >} Why don't you want to use if (index($compare, $string) > -1) { .

Re: Regex problem

2003-06-25 Thread Beau E. Cox
Thanks Tim ans Shishir - Works! Aloha => Beau; - Original Message - From: "Tim Johnson" <[EMAIL PROTECTED]> To: "'Beau E. Cox'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, June 25, 2003 5:30 AM Subject: RE: Regex problem

RE: Regex problem

2003-06-25 Thread Tim Johnson
Try this: my $string = 'I love c++'; my $compare = 'some compare string'; if ($compare =~ /\Q$string/) { #disables metacharacters until \E print "$compare contains $string\n"; } else { print "$compare does not contain $string\n"; } -Original Message- From: Beau E. Cox [mailto:[EM

RE: Regex problem

2003-06-25 Thread Shishir K. Singh
>Hi All - >This script: >use strict; >use warnings; >my $string = 'I love c++'; >my $compare = 'some compare string'; >if ($compare =~ /$string/) { >print "$compare contains $string\n"; >} else { >print "$compare does not contain $string\n"; >} >gives this error: >Nested quantifiers i

Re: regex problem

2002-10-10 Thread Janek Schleicher
Gary Stainburn wrote: > However I'm having problems with the regex. The criteria is: > > The postcode may or may not have anything before it (the $1 bit) > The postcode may only have whitespace, '.' or ',' after it (which does not > want to be kept) > > The postcode is of the format > 1 or

Re: regex problem - solved

2002-10-10 Thread Gary Stainburn
Hi folks, I've sorted it, here's the sub that I'm now using: sub splitit { my ($line)=@_; if ($line=~/^(.*)(\D{1,2}\d{1,2}\s{0,1}\d\D{2})\s*/) { return ($1,$2); } else { return ($line,''); } } Gary On Thursday 10 Oct 2002 2:36 pm, Gary Stainburn wrote: > Hi all, > > I've got a

RE: Regex Problem

2002-07-31 Thread John Francis
in use at > .. . . > Thanks. > > Jess > > -Original Message----- > From: John Francis > To: Balint, Jess > Cc: '[EMAIL PROTECTED]' > Sent: 7/28/02 10:14 PM > Subject: Re: Regex Problem > > Jess, > Try: > s/\$\{(\w+)\}/\$${1}/g;

RE: Regex Problem

2002-07-29 Thread Balint, Jess
t .. . . Thanks. Jess -Original Message- From: John Francis To: Balint, Jess Cc: '[EMAIL PROTECTED]' Sent: 7/28/02 10:14 PM Subject: Re: Regex Problem Jess, Try: s/\$\{(\w+)\}/\$${1}/g; if i understood your problem correctly =) - John O

Re: Regex Problem

2002-07-28 Thread Jeff 'japhy' Pinyan
On Jul 28, Balint, Jess said: >Hello all. I am getting an error with the following reg-exp: > > s/\$\{(\w+)\}/$$1/g; > >I am not sure exactly how to do this type of thing. Is there any way to get >around the error or must I turn off 'strict refs' for this line?? Thanks >alot. If you're try

Re: Regex Problem

2002-07-28 Thread John Francis
Jess, Try: s/\$\{(\w+)\}/\$${1}/g; if i understood your problem correctly =) - John On Sun, 28 Jul 2002, Balint, Jess wrote: > Hello all. I am getting an error with the following reg-exp: > > s/\$\{(\w+)\}/$$1/g; > > I am not sure exactly how to

Re: Regex Problem

2002-07-28 Thread Robin Norwood
"Balint, Jess" <[EMAIL PROTECTED]> writes: > Hello all. I am getting an error with the following reg-exp: > > s/\$\{(\w+)\}/$$1/g; > > I am not sure exactly how to do this type of thing. Is there any way to get > around the error or must I turn off 'strict refs' for this line?? Thanks > a

RE: Regex Problem - please help

2002-06-05 Thread Denham Eva
Thank You - all that have supplied me with a solution to the problem below. I am amazed once again at the power of perl, I had imagined pages of code and what do I receive? five line solutions! Absolutely Amazing. My resolve has been strengthened to learn perl even more. Thanks. -Original Mes

RE: Thanks - Re: Regex problem extracting middle-word part of str ing

2002-06-05 Thread Felix Geerinckx
on Wed, 05 Jun 2002 15:26:12 GMT, Nikola Janceski wrote: > shouldn't it be written as this to aviod that confusion: > my $RandomScript = $Scripts[rand(@Scripts)]; > Yes, that's also my preferred way. -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

RE: Regex Problem - please help

2002-06-05 Thread David . Wagner
Sent: Wednesday, June 05, 2002 06:57 To: 'Denham Eva'; BeginnersPerl (E-mail) Subject: RE: Regex Problem - please help Here is my solution, others will differ... # always print $! on error so you can see the cause open( INFILE,"books.txt" ) || die "Cann't Open:

Re: Regex Problem - please help

2002-06-05 Thread John W. Krahn
Denham Eva wrote: > > Hello Listers, Hello, > I am struggling to get this right. Beginner in perl, so please forgive > ignorance, but the regular expressions are confusing. > > I am trying to read in a file, with content as follows > ---snip--- > 1984 by George Orwell > A BEND IN THE RIVER by

RE: Thanks - Re: Regex problem extracting middle-word part of string

2002-06-05 Thread Nikola Janceski
shouldn't it be written as this to aviod that confusion: my $RandomScript = $Scripts[rand(@Scripts)]; > -Original Message- > From: Felix Geerinckx [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 05, 2002 11:18 AM > To: [EMAIL PROTECTED] > Subject: Re: Thanks

Re: Thanks - Re: Regex problem extracting middle-word part of string

2002-06-05 Thread Felix Geerinckx
> I didn't quite see why you would have to do a +1 on the following: > >my $RandomScript = $Scripts[int(rand($#Scripts + 1))]; The '$#array' construct returns the index of the last element of the '@array'. 'rand $number' returns a random number between 0 (inclusive) and $number (exclusive)

Thanks - Re: Regex problem extracting middle-word part of string

2002-06-05 Thread Rohesia Hamilton Metcalfe
Thanks Janek and Japhy and Drieux for all the help on this! I've yet to look at this Tie::Pick, but will. In the meantime, I've gone with the Japhy solution, $element = @things[rand @things]; because it was the simplest (and works). I didn't quite see why you would have to do a +1 on

RE: Regex Problem - please help

2002-06-05 Thread Janek Schleicher
Janek Schleicher wrote at Wed, 05 Jun 2002 16:19:11 +0200: > Yep, if you like it short ;-) > open BOOK_LIST, " print join "\n", map {chomp; /(.*) by (.*)/; "$2 - $1"} (); ^^^ Oh a typo :-( > close BOOK_LIST; Cheerio, Janek -- To

RE: Regex Problem - please help

2002-06-05 Thread Janek Schleicher
Robert Hanson wrote at Wed, 05 Jun 2002 15:57:05 +0200: > Here is my solution, others will differ... > Yep, if you like it short ;-) open BOOK_LIST, "); close BOOK_LIST; > # always print $! on error so you can see the cause open( INFILE,"books.txt" ) || >die "Cann't > Open: $!"; > > while(

RE: Regex Problem - please help

2002-06-05 Thread Hanson, Robert
Here is my solution, others will differ... # always print $! on error so you can see the cause open( INFILE,"books.txt" ) || die "Cann't Open: $!"; while( ) { chomp; # remove the newline next unless ($_); # skip blank lines # split the line by the seperator my @

Re: Regex problem extracting middle-word part of string

2002-06-04 Thread Janek Schleicher
Rohesia Hamilton Metcalfe wrote at Thu, 30 May 2002 17:28:45 +0200: > #make array of cgi-scripts: > @Scripts=("f-.cgi", "f-bb.cgi", "f-.cgi", "f-.cgi", "f-ee.cgi", > "f-ff.cgi"); > > # pick one at random > srand; > $RandomScript = $Scripts[int(rand(@Scripts))]; > I agre

RE: Regex Problem!!- SOS

2002-05-31 Thread Shishir K. Singh
Thanks a lot Dave!! -Original Message- From: David Gray [mailto:[EMAIL PROTECTED]] Sent: Friday, May 31, 2002 2:45 PM To: [EMAIL PROTECTED] Cc: Shishir K. Singh Subject: RE: Regex Problem!!- SOS > if ($var =~ /^$var1/) { if($var =~ /^\Q$var1\E/) { Should solve your problem -- the

RE: Regex Problem!!- SOS

2002-05-31 Thread David Gray
> if ($var =~ /^$var1/) { if($var =~ /^\Q$var1\E/) { Should solve your problem -- the \Q and \E tell the regex to stop (and start again) interpolating any regex characters it finds in the variable. HTH, -dave -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Re: Regex problem extracting middle-word part of string

2002-05-30 Thread drieux
On Thursday, May 30, 2002, at 11:44 , Jeff 'japhy' Pinyan wrote: > On May 30, drieux said: > >>> $element = @things[rand @things]; >> >> that works - but it makes me nervous... > > You've no need to feel uneasy. It doesn't work because of cruftiness -- I was perchance not clear - I had been d

Re: Regex problem extracting middle-word part of string

2002-05-30 Thread drieux
On Thursday, May 30, 2002, at 11:13 , Jeff 'japhy' Pinyan wrote: > On May 30, drieux said: > >>> srand; >>> $RandomScript = $Scripts[int(rand(@Scripts))]; >>> >> my $RandomScript = $Scripts[int(rand($#Scripts + 1))]; [..] > Don't worry. rand() requires its argument to be a scalar, so rand(

Re: Regex problem extracting middle-word part of string

2002-05-30 Thread drieux
On Thursday, May 30, 2002, at 08:28 , Rohesia Hamilton Metcalfe wrote: [..] > > Any help much appreciated. > > Rohesia perlsonally I'm a fore and aft fan and would have done it like my $fore = 'f-'; my $aft = '.cgi'; my $ScriptName = $1 if ($RandomScript =~ /$fore # all

Re: Regex problem extracting middle-word part of string

2002-05-30 Thread Jeff 'japhy' Pinyan
On May 30, drieux said: >> srand; >> $RandomScript = $Scripts[int(rand(@Scripts))]; >> > my $RandomScript = $Scripts[int(rand($#Scripts + 1))]; > >I am also a bit concerned with trying to seed rand() with a >list, rather than say, the count of the list as noted above. > >never be afraid to

Re: Regex problem extracting middle-word part of string

2002-05-30 Thread drieux
On Thursday, May 30, 2002, at 08:28 , Rohesia Hamilton Metcalfe wrote: > # pick one at random > srand; > $RandomScript = $Scripts[int(rand(@Scripts))]; > > #here's the non-working regex: > $ScriptName =~ s/$RandomScript/\w{3,}\b/; > > $RandomScriptURL = "path/".$ScriptName.".htm"; > > ###

Re: Regex problem extracting middle-word part of string

2002-05-30 Thread Jeff 'japhy' Pinyan
On May 30, Rohesia Hamilton Metcalfe said: >#!/usr/local/bin/perl5 >use CGI qw(:standard); > >#make array of cgi-scripts: >@Scripts=("f-.cgi", "f-bb.cgi", "f-.cgi", "f-.cgi", >"f-ee.cgi", "f-ff.cgi"); > ># pick one at random >srand; >$RandomScript

Re: Regex problem?

2002-01-13 Thread Jeff 'japhy' Pinyan
On Jan 13, Troy May said: >I'm having a problem with a bulletin board I'm setting up. All the smilies >work except for one, the wink one. which be called when you type in ";)". >It won't display the graphic. All the others are fine so I know's it not a >config or directory problem. Here's the

Re: regex problem

2001-12-04 Thread Jeff 'japhy' Pinyan
On Dec 5, Rahul Garg said: >how to check $line contains how many tabs ..is there any func in perl You might want to use the tr/// operator. $tab_count = ($string =~ tr/\t//); if ($tab_count == 1) { # ... } Or, more briefly: if (($string =~ tr/\t//) == 1) { # ... } -- Jeff

Re: regex problem

2001-11-12 Thread Garry Williams
On Mon, Nov 12, 2001 at 07:14:42PM -0600, Gibbs Tanton - tgibbs wrote: > Seems like to me you should just change the last capture to be [^\n] as in > > $data =~ /http:\/\/(.*?):(.*?)@([^\n]*?)/g; > > or something like that. I haven't followed the whole thread, but `[^\n]' is exactly the same a

RE: regex problem

2001-11-12 Thread Gibbs Tanton - tgibbs
Seems like to me you should just change the last capture to be [^\n] as in $data =~ /http:\/\/(.*?):(.*?)@([^\n]*?)/g; or something like that. -Original Message- From: Kris G Findlay To: [EMAIL PROTECTED] Sent: 11/12/2001 5:04 PM Subject: regex problem question if i have $data = "htt

Re: regex problem

2001-07-24 Thread Paul
--- Neema Salimi <[EMAIL PROTECTED]> wrote: I know you've already solved this on your own, but just a small note: > if ($_ =~ /CA\s*ARG\s*1\s*(-*\d+\.\d+)\s*(-*\d+\.\d+)\s*(-*\d+\.\d+)/ the $_ =~ is unnecessary. The match operator defaults to matching $_, so saying /foo/ is exactly equiv

RE: regex problem

2001-07-24 Thread Neema Salimi
Left off a damn parenthesis, it's been a long day. Sorry. Neema Salimi [EMAIL PROTECTED]

Re: Regex Problem

2001-06-21 Thread Me
> while () { > > ($cur_sym, $cur_desc, $usd_unit, $units_usd) = > /^([A-Z]{3})\s+([A-Za-z()\s]{28})\s+(\d+\.\d+)\s+(\d+\.\d+)/; > > # Strip the trailing spaces from $cur_desc > StripTSpace($cur_desc); > > $cur_sym and $started++; > > printf OUTFILE "%s\,%s\,%s\,%s\,%s\,

RE: Regex Problem

2001-06-21 Thread John Edwards
if ($cur_sym) { printf OUTFILE "%s\,%s\,%s\,%s\,%s\,%s\,%s\n",$date, $time, $tz, $cur_sym, $cur_desc, $usd_unit, $units_usd; } -Original Message- From: Jack Lauman [mailto:[EMAIL PROTECTED]] Sent: 21 June 2001 17:15 To: [EMAIL PROTECTED] Subject: Regex Problem I get the followin

Re: Regex problem

2001-05-29 Thread Jeff Pinyan
On May 28, Bornaz, Daniel said: >$stt="The food is under the bar in the barn in the river."; >$stt=~/bar(.*?)river/; >print "$&"; > >The output is: >bar in the barn in the river > >Instead of the expected: >barn in the river For the meantime, you might like to look at chapter 6 of "Learning Per

Re: Regex problem

2001-05-28 Thread Paul Dean
At 05:29 PM 28/05/2001 +0100, Bornaz, Daniel wrote: >Dear all, > >I am trying the following code using ActivePerl 5.6.1.626, in my quest to >find the minimal string between "bar" and "river": > >$stt="The food is under the bar in the barn in the river."; >$stt=~/bar(.*?)river/; >print "$&"; > >The

Re: Regex problem

2001-05-28 Thread John S. J. Anderson
> On Mon, 28 May 2001 17:29:40 +0100, "Bornaz, Daniel" <[EMAIL PROTECTED]> >said: Daniel> $stt="The food is under the bar in the barn in the river."; Daniel> $stt=~/bar(.*?)river/; print "$&"; Daniel> The output is: bar in the barn in the river Daniel> Instead of the expected: barn in the

Re: Regex problem

2001-05-28 Thread Me
> Can anyone explain [Eager / Greedy], please? Perl's regex engine is both Eager (Leftmost start) and Greedy (Rightmost end). The Greedy aspect is subservient to the Eager one. The ? stops it being Greedy but not Eager. To get the rightmost match, you could try adding a .* at the start of the