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