RE: Regex Help

2005-01-27 Thread Mike.Owens
Dirk, I'm not a regex pro, but this worked for me: /^\d{4}(-\d{2}){0,2}$/ I tested it with this: @test = qw( 2004 200412 20041201 2004-12 2004-12-01 ); foreach $test (@test) { print $test : . ($test =~ /^\d{4}(-\d{2}){0,2}$/ ? TRUE : FALSE) . \n; } Regards, Mike -Original

RE: Regex Help

2005-01-27 Thread Gardner, Sam
Title: RE: Regex Help Okay, this is amazingly cloddish, but it does work and may point out where some of your regexes are going wrong. Whenever I have difficulty, I try to simplify it down and then analyze. @strings = qw/ 2004 200412 20041201 2004-12 2004-12-01/; for (@strings){ if (/^\d

RE: Regex Help

2005-01-27 Thread Lloyd Sartor
@listserv.ActiveState.com cc: Subject:RE: Regex Help Dirk, I'm not a regex pro, but this worked for me: /^\d{4}(-\d{2}){0,2}$/ I tested it with this: @test = qw( 2004 200412 20041201 2004-12 2004-12-01 ); foreach $test (@test) { print $test : . ($test =~ /^\d{4}(-\d

RE: Regex Help

2005-01-27 Thread Dirk Bremer
: Thursday, January 27, 2005 11:50 To: [EMAIL PROTECTED] Cc: Dirk Bremer; perl-win32-users@listserv.ActiveState.com; [EMAIL PROTECTED] Subject: RE: Regex Help The reason that 200412 matches in your first regex is that the first four characters match the pattern (as expected) but there is nothing

RE: RegEx help

2004-12-14 Thread Thomas, Mark - BLS CTR
Any thoughts? $lines[0] =~/^(.*?,){36}.*?$/ $lines[0] =~ /^[^,](?:*,[^,]*){36}$/ I like Joe's answer, but if you must use a regex this one works: print scalar(my @commas = $lines[0] =~ /(,)/g); - Mark. ___ Perl-Win32-Users mailing list

RE: RegEx help

2004-12-14 Thread Charles K. Clarkson
[EMAIL PROTECTED] wrote: : I wrote a RegEx to let me know if a line of text has exactly : 36 commas in it (the comma is the separator) and I came up : with this. I don't think it is quite right. I could use a : little pointing in the right direction. Any thoughts? You could use tr/// to

RE: RegEx help

2004-12-14 Thread Joe Discenza
Title: RegEx help Jeff Williams wrote, on Tue 12/14/2004 11:23: I wrote a RegEx to let me know if a line of text has exactly 36 commas init (the comma is the separator) and I came up with this. I don't think itis quite right. I could use a little pointing in the right direction.

Re: RegEx help

2004-12-14 Thread Pat Kusbel
at 09:23 AM 12/14/2004, Jeff Williams wrote: I wrote a RegEx to let me know if a line of text has exactly 36 commas in it (the comma is the separator) and I came up with this. I don't think it is quite right. I could use a little pointing in the right direction. Any thoughts? $lines[0]

Re: RegEx help

2004-12-14 Thread Kester Allen
There's a fun little idiom using tr/// to count the number of occurances of a character in a string: perl -le '$str = a,b,c,d,e; $count = ($str =~ tr/,/,/); print $count' will output 4, the number of commas in a,b,c,d,e. --Kester Jeff Williams wrote, on Tue 12/14/2004 11:23 : I wrote a

Re: regex help

2004-11-03 Thread Andy_Bach
$Bill wrote: ... and \1 is deprecated for $1. I believe that should read [thanks Greg!] ...and \1 is deprecated on the right side of s///. On the left side (as in any regexp), \1 and $1 differ. But as a holdover from sed, \1 means the same as $1 on the right side of the subst. \1 isn't the

RE: regex help

2004-11-02 Thread Peter Eisengrein
Title: RE: regex help Assuming your dates are always in the same format, this would work: print $1\n while ($_ =~ /(\d{1,2}\:\d{2} [ap]m)/gi); -Pete -Original Message- From: Malcolm Mill [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 02, 2004 4:11 PM To: [EMAIL

RE: regex help

2004-11-02 Thread Ganesh Babu Nallamothu, Integra-India
Hi, Your Find patter is wrong. Use the following Pattern: s/([\t]\d{2}[:]\d{2}[\s])/\1/; Regards, Gopal.R -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Malcolm Mill Sent: Wednesday, November 03, 2004 2:41 AM To: [EMAIL PROTECTED] Subject: regex help

Re: regex help

2004-11-02 Thread $Bill Luebkert
Ganesh Babu Nallamothu, Integra-India wrote: Hi, Your Find patter is wrong. Use the following Pattern: s/([\t]\d{2}[:]\d{2}[\s])/\1/; \t, \s and : do not need to be in a character class and \1 is deprecated for $1. This should be equivalent: s/(\t\d{2}:\d{2}\s)/$1/; You should

Re: REGEX help!

2004-01-14 Thread $Bill Luebkert
Jamie Murray wrote: Hi Glenn, I have worked on this further and looked at some of the previous posts. I have tried this with all different combinations of ip address and this has worked. Of course I got the idea from a previous post from Alex and Mark Thomas. Please understand I could have

Re: REGEX help!

2004-01-13 Thread Jamie Murray
Hey Alex, I jumped a little quick there, the previous post does work but I had a doh moment and forgot your upper range match could only be 254 at most. Sorry about that. if($num =~ /^[0-2][0-5][0-4]\.[0-2][0-5][0-4]\.[0-2][0-5][0-4]\.[0-2][0-5][0-4]$/) after each class [] use {num,num} to

Re: REGEX help!

2004-01-13 Thread Raul Davletshin
f ($ip =~ /^\d[0-254]\.\d[0-254]\.\d[0-254]\.\d[0-254]$/) incorect way of matching ip address, it will work fore 61.14.95.02, but will not work for 66.18.99.07. The problem here you just trying to match 2 digital number instead of 3 digits. For example using [] [aDc] true for a but not for aa,

Re: REGEX help!

2004-01-13 Thread Glenn Linderman
On approximately 1/12/2004 8:36 PM, came the following characters from the keyboard of Jamie Murray: Hey Alex, I jumped a little quick there, the previous post does work but I had a doh moment and forgot your upper range match could only be 254 at most. Sorry about that. if($num =~

Re: REGEX help!

2004-01-13 Thread $Bill Luebkert
Jamie Murray wrote: Hey Alex, I jumped a little quick there, the previous post does work but I had a doh moment and forgot your upper range match could only be 254 at most. Sorry about that. if($num =~ /^[0-2][0-5][0-4]\.[0-2][0-5][0-4]\.[0-2][0-5][0-4]\.[0-2][0-5][0-4]$/) ^^^ ^^^

Re: REGEX help!

2004-01-13 Thread Jamie Murray
and am just trying my best. Thanks! - Original Message - From: $Bill Luebkert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 5:07 AM Subject: Re: REGEX help! Jamie Murray wrote: Hey Alex, I jumped a little quick there, the previous post does work but I had

Re: REGEX help!

2004-01-13 Thread Glenn Linderman
Subject: Re: REGEX help! BiLL, If you check my second post I made the correction but I'm still correct in my example and method. Actually the e-mail from Raul Davletshin pretty much verifys what I had also stated and he's also correct. As for explaining [0-2] 0 or 1 or 2 are all possibilities

Re: REGEX help!

2004-01-13 Thread Jamie Murray
\.$octet$/o; print yes if $ip =~ $valid_ip; - Original Message - From: Glenn Linderman [EMAIL PROTECTED] To: Jamie Murray [EMAIL PROTECTED] Cc: $Bill Luebkert [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 6:24 PM Subject: Re: REGEX help! On approximately 1/13

Re: REGEX help!

2004-01-13 Thread Glenn Linderman
: Glenn Linderman [EMAIL PROTECTED] To: Jamie Murray [EMAIL PROTECTED] Cc: $Bill Luebkert [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 6:24 PM Subject: Re: REGEX help! On approximately 1/13/2004 6:49 AM, came the following characters from the keyboard of Jamie Murray: Hi

Re: REGEX help!

2004-01-13 Thread Jamie Murray
Thanks for the discussion,clear explanation and advice Glenn. - Original Message - From: Glenn Linderman [EMAIL PROTECTED] To: Jamie Murray [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, January 14, 2004 12:48 AM Subject: Re: REGEX help! On approximately 1/13/2004 7:01 PM

Re: REGEX help!

2004-01-13 Thread Mike Jackson
]; [EMAIL PROTECTED] Sent: Tuesday, January 13, 2004 6:24 PM Subject: Re: REGEX help! On approximately 1/13/2004 6:49 AM, came the following characters from the keyboard of Jamie Murray: Hi guys, I have seen my error which I have overlooked and don't mind admitting it. : ) Course don't hold

Re: REGEX help!

2004-01-12 Thread Jamie Murray
just a stab starts with any digit(s) = any number of digits or = 0 or 1 or none(?=can be none but at most 1) followed by any 2 numbers = 2 followed by number between 0 and 4 followed by any number = 25 followed by any number between 0 and 5 followed by . the rest is repeat (I think that

Re: Regex Help Needed

2003-09-02 Thread $Bill Luebkert
Dax T. Games wrote: I have a list of characters. I need to get a list of all possble sequences of these characters for example. I have a string that consists of '-mevqgn' I need to pattern match any combination of 'mevqgn' with a preceding - or --. Right now this is what I am doing

RE: Regex Help Needed

2003-09-02 Thread Wagner, David --- Senior Programmer Analyst --- WGO
I wanted to use tr but was uanble to accomplish the task that way. So I used regex like the following: use strict; my %MCTWW = qw(m -1 e -1 v -1 q -1 g -1 n -1);my $MyCharsToWorkWith = \%MCTWW; $_ = '--mepqgn '; if ( ! /-{1,2}(\S+)/ ) { printf "Expecting a hyphen or two floowed by non

Re: Regex Help Needed

2003-09-02 Thread Will of Thornhenge
Have you tried playing around with character sets? Something like $target = 'mevqgn'; $length_target = length $target; if ( $LS_Val =~ /-{1,2}[$target]{$length_target}/ ) { #do something } Whether the above would work for you would depend on whether the code can ignore positive matches on

RE: Regex Help Needed

2003-09-02 Thread Hanson, Rob
Here is another variation... #!/usr/bin/perl check('-mevqgn');check('-memqgn');check('-ngmevq');check('--meqvgn'); sub check{ my $LS_Val = shift; if ($LS_Val =~ /-{1,2}([mevqgn]{6})/ and unique_chars($1)) { print "Ding Ding! $LS_Val is good!\n"; } else { print "Flopped: $LS_Val\n"; }}

Re: Regex Help Needed

2003-09-02 Thread Carl Jolley
On Tue, 2 Sep 2003, Dax T. Games wrote: I have a list of characters. I need to get a list of all possble sequences of these characters for example. I have a string that consists of '-mevqgn' I need to pattern match any combination of 'mevqgn' with a preceding - or --. Right now this is

Re: Regex Help Needed

2003-09-02 Thread Charlie Schloemer
Wow... looks like some good replies to this one. Here's a less elegant, recursive approach (until I learn map :-) #!perl -w # print all 720 permutations using letters: e m v q g n use strict; sub mutate { my ($in) = @_; if (length($in) == 6) { print $in\n; $in = ''; } else {

RE: Regex Help Needed

2003-09-02 Thread Arms, Mike
It looks like you may be doing standard command line option parsing (or almost standard as the '--' prefix is reserved for long option names). If this is so, look at GetOpt::Std . For a subroutine that does what you specified (tested): sub is_DTG_Option ($) { my $opt = shift; return

RE: Regex Help Needed

2003-09-02 Thread Messenger, Mark
Equally dirty, but possibly more flexible: $_='aSdFgHjk'; # Letters to look for. $alpha1=lc(join('',sort(split(//; $LS_Val=shift; $LS_Val=~s/^-//g; # Drop preceding dashes $alpha2=lc(join('',sort(split(//,$LS_Val; if ($alpha1 eq $alpha2) {print "Pattern found!\n";}

Re: Regex Help Needed

2003-09-02 Thread John Deighan
At 01:26 PM 9/2/2003, Dax T. Games wrote: I have a list of characters. I need to get a list of all possble sequences of these characters for example. I have a string that consists of '-mevqgn' I need to pattern match any combination of 'mevqgn' with a preceding - or --. Right now this is what

Re: Regex Help Needed

2003-09-02 Thread $Bill Luebkert
$Bill Luebkert wrote: Dax T. Games wrote: I have a list of characters. I need to get a list of all possble sequences of these characters for example. I have a string that consists of '-mevqgn' I need to pattern match any combination of 'mevqgn' with a preceding - or --. Right now this

RE: Regex Help Needed

2003-09-02 Thread Schneider, Kenneth (EKT)
how about sorting the letters first: $var="meqgvn"; $sortedvar=join("", sort(split("", $var))); if ($sortedvar eq "egmnqv") { print "yes!\n";} --ken -Original Message-From: Dax T. Games [mailto:[EMAIL PROTECTED]Sent: Tuesday, September 02, 2003 12:26 PMTo: Perl

RE: Regex help

2003-02-18 Thread Beckett Richard-qswi266
I'm trying to match a string which would start with http://, then a character string where there is one one or more instances of %, followed by one instance of .com, i.e. http://www.%55.com Here is my current pattern: http://.*%+.*(\.com) However, if there are two or more

RE: RegEx help

2002-11-15 Thread Bullock, Howard A.
You could cheat a little instead of trying to do it with just a RE, use an embeded tr/// or s///: my $text = 'axxxccvvvacassdcxaswrefaejjawerassdcxaswrefaejhhaasera'; $text =~ s#s(.*?)e# my $x = $1; $x =~ tr/a/8/; sprintf 's%se', $x #eg; -- Thanks. The main problem I was having was I

Re: RegEx help

2002-11-15 Thread $Bill Luebkert
Bullock, Howard A. wrote: You could cheat a little instead of trying to do it with just a RE, use an embeded tr/// or s///: my $text = 'axxxccvvvacassdcxaswrefaejjawerassdcxaswrefaejhhaasera'; $text =~ s#s(.*?)e# my $x = $1; $x =~ tr/a/8/; sprintf 's%se', $x #eg; Your two little dashes make

Re: RegEx help

2002-11-14 Thread $Bill Luebkert
Bullock, Howard A. wrote: I want to alter some characters in a text variable, but only those between two markers. $text = 'axxxccvvvacassdcxaswrefaejjawerassdcxaswrefaejhhaasera'; I want to specify the start s and the end e and only change the a's to 8's between the markers. How do I

Re: Regex help - trim doc contents

2002-02-04 Thread Jean-Baptiste Nivoit
* Stephen Patterson ([EMAIL PROTECTED]) wrote: I have a scalar, $doc, which contains a plain ascii file, and which I'll be storing on a database (for searching). (...) Can anyone help? There's a module called Whitespace on CPAN, would that work for you? Additionnally, there's also a

RE: Regex Help Please!

2002-01-10 Thread Wagner-David
Here is a simplistic approach. May want more edits, but is a starting place. Placing the data for testing under DATA: while ( DATA ) { chomp; next if ( /^\s*$/ ); # bypass blank lines if ( /^!--\s(\d+.+)\s\/\s(\d+)\s-- rowv (.+) \/vv (.+) \/v\/row/ ) { printf

RE: Regex Help Please!

2002-01-10 Thread Ron Hartikka
Works but not if you have more or fewer than 2 values in a row. Do you? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Wagner-David Sent: Thursday, January 10, 2002 1:31 PM To: 'Gordon Brandt'; [EMAIL PROTECTED] Subject: RE: Regex Help Please

RE: Regex Help Please!

2002-01-10 Thread Wagner-David
PROTECTED] Subject: RE: Regex Help Please! Works but not if you have more or fewer than 2 values in a row. Do you? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Wagner-David Sent: Thursday, January 10, 2002 1:31 PM To: 'Gordon Brandt'; [EMAIL

RE: Regex Help Please!

2002-01-10 Thread Brown, Aaron D
:: -Original Message- :: From: Gordon Brandt [mailto:[EMAIL PROTECTED]] :: Sent: Thursday, January 10, 2002 12:17 PM :: To: [EMAIL PROTECTED] :: Subject: Regex Help Please! :: :: [-snip-] :: :: Input file: :: | :: :: (misc header information I want to delete) :: ::

Re: Regex Help Please!

2002-01-10 Thread dolljunkie
A less elegant (perhaps) solution, but effective, no matter how many rows / values: while() { s/\r//g; # I hate that carriage return chomp; next if(!/^.*\!--/); # skip non-matching lines my @values; my $ts = $1 if(s/\!--\s*(.*?)\s*--//); my($ts1,$ts2) =

Re: Regex Help

2001-03-29 Thread Carl Jolley
sday, March 27, 2001 4:05 PM Subject: Re: Regex Help Try using this: use File::Basename; # for picking apart file specs # filename, directory, extension # ($filena,$ldir,$ext)

Re: Regex Help

2001-03-28 Thread Lee Goddard
PROTECTED] Cc: "perl-win32-users" [EMAIL PROTECTED] Sent: Tuesday, March 27, 2001 4:05 PM Subject: Re: Regex Help Try using this: use File::Basename; # for picking apart file specs # filename, directory, extension # ($filena,$ldir,$ext) = fileparse($ARGV[0],'\..*');

RE: Regex Help

2001-01-31 Thread Wagner-David
I tried this and it seemed to work: my $InputLine = '(! SUBSTR(DB.USER1,2,5)="9") .AND. (LEFT(DB.USER1,1)"1") .AND. (ALLTRIM(DB.OUNCEWT)"2")'; my $InputLine1 = '(! SUjSTR(DB.USER1,2,5)="9") .AND. (LEFT(DB.USER1,1)"1") .AND. (ALLTRIM(DB.OUNCEWT)"2")'; my $Str = '(!

Re: Regex: help with '\'

2001-01-14 Thread $Bill Luebkert
"Bullock, Howard A." wrote: Is there a way to get the following text to match? If the '\' in '1\V' is changed, the regex matches. I would like to maintain the RAW text if possible. $c = 'JUA_APPS01\VOL1:\APPS'; $d = 'JUA_APPS01\VOL'; if ($c =~ /$d/) { print "matched\n"; }