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?

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

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.

Re: regex problem

2010-11-05 Thread Robert Wohlfarth
On Fri, Nov 5, 2010 at 8:34 AM, jm jm5...@gmail.com 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

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 shawnhco...@gmail.com wrote: On 10-11-05 09:34 AM, jm wrote: i have csv files in the following format,

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 installed.

Re: Regex problem

2009-12-26 Thread Chris Charley
- Original Message - From: Owen rc...@pcug.org.au 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

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 not working

Re: Regex problem

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

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 = 'a.gif';

Re: Regex problem

2009-03-11 Thread Jim Gibson
On 3/10/09 Tue Mar 10, 2009 8:41 PM, howa howac...@gmail.com 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
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 =~

Re: Regex problem

2009-03-11 Thread Chas. Owens
On Wed, Mar 11, 2009 at 12:53, howa howac...@gmail.com 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.

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;; $a

Re: Regex problem

2009-03-10 Thread Jim Gibson
On 3/10/09 Tue Mar 10, 2009 8:19 AM, howa howac...@gmail.com 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

2009-03-10 Thread Chas. Owens
On Tue, Mar 10, 2009 at 11:19, howa howac...@gmail.com 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 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

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

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

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

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 the content in $name

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 variable

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!au$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 like

Re: Regex Problem.

2005-08-18 Thread Wiggins d'Anconia
Sara wrote: I am at a loss here to generate REGEX for my problem. I have an input query coming to my cgi script, containg a word (with or without spaces e.g. blood Globin Test etc). What I am trying to do is to split this word (maximum of 3 characters) and find the BEST possible matching

Re: Regex Problem.

2005-08-18 Thread Sara
That's worked like a charm, You ALL are great. Thanks everyone for help. Sara. - Original Message - From: [EMAIL PROTECTED] To: 'Sara' [EMAIL PROTECTED] Sent: Thursday, August 18, 2005 10:50 PM Subject: RE: Regex Problem. Hi Sara, what is about somthing like $string = 'blood

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 /var/ra... It

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. [If they

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-BATCHperl -e '$a=q{/var/run}; $home=q{/var/123};print Yes - $a like $home\n if $a =~ /^$home/;' SUN1-BATCHperl -e '$a=q{/var/run}; $home=q{/var/ra};print Yes - $a like $home\n if $a =~

RE: regex problem

2004-08-10 Thread DBSMITH
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 mean : I'm not sure. has the Orig strings

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

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 : samlpe data snipped Here is my code: foreach

Re: regex problem

2004-08-09 Thread DBSMITH
: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, 2004 3:54 PM Subject: regex problem All I am getting the error from

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

RE: regex problem

2004-08-09 Thread DBSMITH
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 [EMAIL PROTECTED] [EMAIL PROTECTED] wrote

RE: regex problem

2004-08-09 Thread Charles K. Clarkson
[EMAIL PROTECTED] mailto:[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 it

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-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. like

RE: REGEX PROBLEM (fwd)

2003-07-25 Thread magelord
---BeginMessage--- 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

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-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$page; \w

Re: Regex problem

2003-07-20 Thread Wiggins d'Anconia
Sara wrote: $name = SARA DEILEY; how its possible to grasp only initials for First and Last name i.e $name =SD?? Depends on how standardized your data is, something simple like this should work for the above: my $name = 'SARA DEILEY'; my $initials; if ($name =~ /^(\w)\w*\s+(\w)\w*/) {

RE: Regex problem

2003-07-20 Thread Scot Robnett
d'Anconia [mailto:[EMAIL PROTECTED] Sent: Sunday, July 20, 2003 7:10 PM To: Sara Cc: org Subject: Re: Regex problem Sara wrote: $name = SARA DEILEY; how its possible to grasp only initials for First and Last name i.e $name =SD?? Depends on how standardized your data is, something simple like

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 in regex; marked

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:[EMAIL

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 Try this: my $string = 'I love c++'; my $compare = 'some

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 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; } gives this

RE: Regex problem

2003-06-25 Thread Derek Byrne
:[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 $compare = 'some compare string'; if ($compare =~ /$string/) { print $compare contains

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: my $string = 'I love c++'; my $compare = 'some compare string

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-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 2

RE: Regex Problem

2002-07-31 Thread John Francis
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 On Sun, 28 Jul 2002, Balint, Jess wrote: Hello all. I am getting an error with the following reg-exp

RE: Regex Problem

2002-07-29 Thread Balint, Jess
: 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 On Sun, 28 Jul 2002, Balint, Jess wrote: Hello all. I am getting

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 alot. I'm

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 do

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 trying to

Re: regex - problem

2002-07-22 Thread perl-dvd
Alex, Did you get the problem fixed? Yes it was because you did not escape your . when you wanted a . instead of an any character. ..[a-zA-Z]{2,3} will match .abc, but it will also match abcd but \.[a-zA-Z]{2,3} will require that the first character this part of the regular expression

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( INFILE ) { chomp; # remove the newline next unless ($_); # skip blank lines # split the line by the seperator

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, books.txt or die Can't Open: $!; print join \n, map {chomp; /(.*) by (.*)/; $2 - $1} (BOOKLIST); close BOOK_LIST; # always print $! on error so

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, books.txt or die Can't Open: $!; print join \n, map {chomp; /(.*) by (.*)/; $2 - $1} (BOOKLIST); ^^^ Oh a typo :-( close

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: 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).

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: Regex problem

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 V.S.

RE: Regex Problem - please help

2002-06-05 Thread David . Wagner
-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: $!; while( INFILE ) { chomp; # remove the newline next unless ($_); # skip blank lines

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 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

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 agree to Drieux that

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!!- 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 \Q

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 step aside,

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 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(@x) is like

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 doing stuff

Re: Regex problem?

2002-01-13 Thread Ahmed Moustafa
Hi Troy, I don't understand your regex. I think the following should work fine: $message =~ s/(;-\)|;\))/img src=$cfg{'nonCgiPath'}\/wink.gif\/g; Regards, --Ahmed [EMAIL PROTECTED] | http://www.photo.net/users/ahmed Troy May wrote: Hello, I'm having a problem with a bulletin board I'm

Re: Regex problem?

2002-01-13 Thread Curtis Poe
--- Troy May [EMAIL PROTECTED] wrote: Hello, 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

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 as

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-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

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 following

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 Perl's Regular

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

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 output is: bar in