RE: regex like option *values*

2011-03-07 Thread Brian Raven
> -Original Message- > From: p sena [mailto:senapati2...@yahoo.com] > Sent: 05 March 2011 05:34 > To: perl-win32-users@listserv.ActiveState.com; Brian Raven > Subject: RE: regex like option *values* >>>>> __DATA__ >>>>> abc0[1-9].ctr.[pad,spd]

RE: regex like option *values*

2011-03-04 Thread p sena
> > >> __DATA__ > > >> abc0[1-9].ctr.[pad,spd].set.in > > >> abc[01-22].ctr.[pad,spd].set.in > > >> abcL[1,2,3].ctr.[pad,spd].set.in > > >> abcL[1,2,3].ctr.[pad,spd].set.in > > >> abcL[1,2,3].ctr.[70,001].set.in > > >> > > --- > > >> > > >> It should

RE: regex like option *values*

2011-03-04 Thread p sena
> >> __DATA__ > >> abc0[1-9].ctr.[pad,spd].set.in > >> abc[01-22].ctr.[pad,spd].set.in > >> abcL[1,2,3].ctr.[pad,spd].set.in > >> abcL[1,2,3].ctr.[pad,spd].set.in > >> abcL[1,2,3].ctr.[70,001].set.in > >> > --- > >> > >> It should work for lists of ra

RE: regex like option *values*

2011-03-03 Thread Brian Raven
> -Original Message- > From: p sena [mailto:senapati2...@yahoo.com] > Sent: 03 March 2011 15:40 > To: perl-win32-users@listserv.ActiveState.com; Brian Raven > Subject: RE: regex like option *values* >> __DATA__ >> abc0[1-9].ctr.[pad,spd].set.in >> abc[01

RE: regex like option *values*

2011-03-03 Thread p sena
> __DATA__ > abc0[1-9].ctr.[pad,spd].set.in > abc[01-22].ctr.[pad,spd].set.in > abcL[1,2,3].ctr.[pad,spd].set.in > abcL[1,2,3].ctr.[pad,spd].set.in > abcL[1,2,3].ctr.[70,001].set.in > --- > > It should work for lists of ranges, and ranges of strings

RE: regex like option *values*

2011-03-03 Thread Brian Raven
> -Original Message- > From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl- > win32-users-boun...@listserv.activestate.com] On Behalf Of p sena > Sent: 02 March 2011 17:16 > To: perl-win32-users@listserv.ActiveState.com > Subject: regex like option *values* > > Hi, > > I wa

Re: Regex: Remove tag

2006-10-29 Thread Chris Wagner
First convert the links then strip the html tags. $text =~ s/(.+?)/[$1] {$2}/ig; -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com

Re: Regex Needed

2006-03-25 Thread DZ-Jay
Unpack is even faster, for fixed-format strings. dZ. On Mar 24, 2006, at 22:19, Chris Wagner wrote: At 10:38 AM 3/24/2006 -0700, Paul Rousseau wrote: I am looking for help on a regex that examines strings such as "xxxN yyy sssNNN" "xxxN yyyNyyy sss" "xxxN yyyNyyy ssN"

Re: Regex Needed

2006-03-24 Thread Chris Wagner
At 10:38 AM 3/24/2006 -0700, Paul Rousseau wrote: > I am looking for help on a regex that examines strings such as > >"xxxN yyy sssNNN" >"xxxN yyyNyyy sss" >"xxxN yyyNyyy ssN" > >and returns only the sss part? N is always a numeral, and s is always >alphabetic. Do u have to examine

Re: Regex Needed

2006-03-24 Thread
Try this: $string =~ /^.{3}\d\s[^\s]+\s([a-zA-Z]+)\d+$/; $prefix = $1; That should match: - any three characters at the beginning of the string: ^.{3} - followed by a number: \d - followed by whitespace: \s - followed by any one or more characters until the next whitespace [^\s]+ -

Re: Regex Needed

2006-03-24 Thread David Legault
Something like this : /(\w\s){2}([a-zA-Z]+)\d*/ David Joe Discenza wrote: Paul Rousseau wrote, on Friday, March 24, 2006 12:38 PM :I am looking for help on a regex that examines strings such as : : "xxxN yyy sssNNN" : "xxxN yyyNyyy sss" : "xxxN yyyNyyy ssN" : : and returns

Re: Regex Needed

2006-03-24 Thread Brian H. Oak
Paul, Give this a shot: /^\w+\s+\w+\s+([A-Za-z]+)\d+/ A regex should be as explicit and exclusive as possible, so I would remove the lowercase (a-z) portion of the character class if you know for sure that the letters you want will always be uppercase. -Brian _ Bria

RE: Regex Needed

2006-03-24 Thread Jerry Kassebaum
$string = "MBH1 WELL PIT050"; $string =~ s/.* (.*?)\d+/\1/; # Questionmark makes it non-greedy ($prefix) = $string; # Didn't figure out how to do ($prefix) = $string =~ print "$prefix"; <>; ** Hello, I am looking for help on a

RE: Regex Needed

2006-03-24 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > Hello, > >I am looking for help on a regex that examines strings such as > > "xxxN yyy sssNNN" > "xxxN yyyNyyy sss" > "xxxN yyyNyyy ssN" > > and returns only the sss part? N is always a numeral, and s is always > alphabetic. > > Here is what I have so

RE: Regex Needed

2006-03-24 Thread Joe Discenza
Paul Rousseau wrote, on Friday, March 24, 2006 12:38 PM :I am looking for help on a regex that examines strings such as : : "xxxN yyy sssNNN" : "xxxN yyyNyyy sss" : "xxxN yyyNyyy ssN" : : and returns only the sss part? N is always a numeral, and s : is always alphabetic. Does

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the Matched String

2005-10-10 Thread Andy_Bach
Not sure I'm getting it completely, but using match in a while loop w/ the /g modifier lets you process a string one match at a time: my $string = "Lots of words to be read one at a time.\nthough more than one line"; while ( $string =~ /(\w+)/g ) { print "Found: $1\n"; print "Proceessing ..

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString

2005-10-10 Thread Veli-Pekka Tätilä
Joe Discenza wrote: "Veli-Pekka Tätilä" wrote, on Sun 10/9/2005 15:58 replacement is so complex that it cannot be expressed as a straight substitution. So I would have to find a piece of text, process it in a separate function, and replace the matched text with the newly computed text. This goes

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the Matched String

2005-10-10 Thread Veli-Pekka Tätilä
Kenneth McNamara wrote: You're implying that the music macro language is pos() sensitive. That is a pretty severe problem in itself. Hmm, I'm not totally sure if it is. But true certain modifiers apply until the next note, such as one or more periods. My MML experience is actually from trying t

RE: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString

2005-10-10 Thread Joe Discenza
Title: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString "Veli-Pekka Tätilä" wrote, on Sun 10/9/2005 15:58: Yet another newbie question about regular expressions:: I'd like to find and replace bits of text as usual. However, rather than: replace all occurrences in one

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the Matched String

2005-10-10 Thread Kenneth McNamara
Veli-Pekka You're implying that the music macro language is pos() sensitive. That is a pretty severe problem in itself. Can you output the macro language in a format that is not position sensitive - do a global change - then process the macro language back into original format? I thin

Re: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString

2005-10-09 Thread Chris Wagner
So what ur saying is that u want to do a lot of substitutions in one pass. U could always have one s///g for each thing u want substituted and run it n times. Can u post some actual strings that u want to parse and the substitutions? Then we can figure it out. At 10:58 PM 10/9/05 +0300, =?iso-88

Re: Regex

2005-09-27 Thread $Bill Luebkert
Chris Wagner wrote: > At 05:11 PM 9/27/05 -0700, $Bill Luebkert wrote: > >>\s* means to grab any WS at the current position (including the case where >> there is none). >> >>\s*? means 0 or 1 of the above which is totally meaningless - you've already >> eaten all the WS with the \s*, so in my

Re: Regex

2005-09-27 Thread Chris Wagner
At 05:11 PM 9/27/05 -0700, $Bill Luebkert wrote: >\s* means to grab any WS at the current position (including the case where >there is none). > >\s*? means 0 or 1 of the above which is totally meaningless - you've already >eaten all the WS with the \s*, so in my opinion the ? is redundant t

Re: Regex

2005-09-27 Thread $Bill Luebkert
Chris Wagner wrote: > At 12:08 AM 9/27/05 -0700, robert johnson wrote: > >>and by the way, *? is redundant. >>* means zero or more. >>? means zero or one. > > > > Actually the *? construct is not a redundancy. It calls for a minimal match > rather than a maximal match, which is the default.

Re: Regex

2005-09-27 Thread Chris Wagner
At 12:08 AM 9/27/05 -0700, robert johnson wrote: >and by the way, *? is redundant. >* means zero or more. >? means zero or one. Actually the *? construct is not a redundancy. It calls for a minimal match rather than a maximal match, which is the default. Although it was useless in the example.

Re: Regex

2005-09-27 Thread robert johnson
David Budd wrote: I thought this was working, but my logs just showed a case where it seems not to do what I want. Why does: $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ; Not become true when $body contains: Library Card: 0240742 i'd bet that it passes when you have some whitespace af

Re: Regex

2005-09-25 Thread Chris Wagner
At 02:42 PM 9/25/05 +1000, [EMAIL PROTECTED] wrote: >> Why does: >> $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ; >> Not become true when $body contains: >> Library Card: 0240742 >Having looked at other replies to this, isn't it irrelevant what comes >after the "(\d{7})" part of the re. It'

Re: Regex

2005-09-24 Thread $Bill Luebkert
John wrote: > David Budd wrote: > >>I thought this was working, but my logs just showed a case where it seems not >>to do what I want. >>Why does: >>$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ; >>Not become true when $body contains: >>Library Card: 0240742 >> >>Just possibly there's some

Re: Regex

2005-09-24 Thread John
David Budd wrote: I thought this was working, but my logs just showed a case where it seems not to do what I want. Why does: $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ; Not become true when $body contains: Library Card: 0240742 Just possibly there's some dodgy html or something in the o

RE: Regex

2005-09-21 Thread Chris Wagner
At 09:07 AM 9/21/05 +0100, [EMAIL PROTECTED] wrote: >> You state that there must be a NON numeric at end of >> line. I would have \D* or \D*$. > >Excellent suggestion. I shall implement it forthwith. Actually, to make sure ur string ends with a non-numeric u need \D$ not \D*$. \D* matches 0

RE: Regex

2005-09-21 Thread David Budd
> > You state that there must be a NON numeric at end of > line. I would have \D* or \D*$. Excellent suggestion. I shall implement it forthwith. Part of the reason I was perplexed was that this script ran for a year with nobody complaining. In fact, I discovered some time after I'd post

RE: Regex

2005-09-20 Thread Matthew Ryan
David wrote: >I thought this was working, but my logs just showed a case where it seems >not to do what I want. >Why does: >$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ; >Not become true when $body contains: >Library Card: 0240742 >Just possibly there's some dodgy html or something in the o

RE: Regex

2005-09-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > I thought this was working, but my logs just showed a case where it > seems not to do what I want. > Why does: > $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ; > Not become true when $body contains: > Library Card: 0240742 > > Just possibly there's some dodgy html

Re: Regex

2005-09-20 Thread $Bill Luebkert
David Budd wrote: > I thought this was working, but my logs just showed a case where it seems not > to do what I want. > Why does: > $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ; What's the last \D for ? '\s*?' should just be '\s*' - same with \D*?. > Not become true when $body contains:

Re: Regex

2005-09-20 Thread James Sluka
Perhaps you need to change the final \D to \D* since it is possible that there is nothing after the 7 digits. Or perhaps omit the last \D completely. Your code works with; $body='Library Card: 0240742 '; # has a character after the 7 digits but fails with; $body='Library Card: 0240742';

Re: Regex

2005-09-20 Thread Siebe Tolsma
The string $body ("Library Card: 0240740") does not end in \D ("not a number"). You might want to add a * to that if you want to make sure it matches strings that _do_ end in \D (ie. \n or \r\n or whatever stuff comes behind the "ID") and those that end in the ID itself. - Original Message

RE: Regex

2005-09-20 Thread Joe Discenza
Title: Regex David Budd wrote, on Tue 9/20/2005 10:57: : I thought this was working, but my logs just showed a case where it seems not to do what I want.: Why does:: $OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;: Not become true when $body contains:: Library Card: 0240742 Probably b

RE: regex expression to determine if i have a valid email!!

2005-09-16 Thread Ahlsen-Girard Edward F Contr MPSG
Title: RE: regex expression to determine if i have a valid email!!  There is also the address checking _expression_ in the very nice Mail-Sendmail module. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED] Sent: Friday, September 16

RE: regex expression to determine if i have a valid email!!

2005-09-16 Thread Thomas, Mark - BLS CTR
S CTR; 'perl-win32-users' > Subject: RE: regex expression to determine if i have a valid email!! > > so mark... > > what you're saying is that i should write a simple perl app > that does the > email validation, and call it from the php app, passing it

RE: regex expression to determine if i have a valid email!!

2005-09-16 Thread bruce
S CTR Sent: Friday, September 16, 2005 5:49 AM To: '[EMAIL PROTECTED]'; 'perl-win32-users' Subject: RE: regex expression to determine if i have a valid email!! > i've got a php app Say it isn't so! :) > i finally figured that someone here, might have the exa

Re: regex expression to determine if i have a valid email!!

2005-09-16 Thread pDale
On 9/16/05, Chris Wagner <[EMAIL PROTECTED]> wrote: Well it very much depends on what u consider a "valid" email address.Because technically, anything can be valid in some context.  What u probablywant here is a fully qualified Internet mail address.  The basic form of this would be m/[EMAIL PROTEC

RE: regex expression to determine if i have a valid email!!

2005-09-16 Thread Thomas, Mark - BLS CTR
> i've got a php app Say it isn't so! :) > i finally figured that someone here, might have the exact > soln to my prob! 1. Make sure it is formatted correctly, as per RFC 822. To do that, there is one big scary regex created by Jeffrey Friedl (author of Mastering Regular Expressions). If you ch

Re: regex expression to determine if i have a valid email!!

2005-09-16 Thread $Bill Luebkert
Chris Wagner wrote: > Well it very much depends on what u consider a "valid" email address. > Because technically, anything can be valid in some context. What u probably > want here is a fully qualified Internet mail address. The basic form of > this would be m/[EMAIL PROTECTED]/. The protocol

Re: regex expression to determine if i have a valid email!!

2005-09-15 Thread $Bill Luebkert
bruce wrote: > hi... > > i've got a php app, and i'm trying to figure out how/where to turn to to get > a good working regex in order to determine if i have a valid email address > > any help/thoughts/etc.. would be seriously helpful... > > i've come across a great many preg_match functions for

Re: regex expression to determine if i have a valid email!!

2005-09-15 Thread Chris Wagner
Well it very much depends on what u consider a "valid" email address. Because technically, anything can be valid in some context. What u probably want here is a fully qualified Internet mail address. The basic form of this would be m/[EMAIL PROTECTED]/. If u want to limit that to known "legitima

RE: regex expression to determine if i have a valid email!!

2005-09-15 Thread Charles K. Clarkson
bruce <> wrote: : i've got a php app, and i'm trying to figure out how/where to : turn to to get a good working regex in order to determine if i : have a valid email address : : any help/thoughts/etc.. would be seriously helpful... : : i've come across a great many preg_match functions for php,

RE: RegEx

2005-08-29 Thread Thomas, Mark - BLS CTR
> >Problem > > > >If the string does not contain a trailing \ then add one. > > $string .= "\\" unless $string =~ /\\$/; > or, if you prefer, > $string .= "\\" if $string !~ /\\$/; Or $string =~ s{\\?$}{\\}; -- Mark Thomas Internet Systems Architect ___ BAE

Re: RegEx

2005-08-28 Thread Eric Amick
On Sun, 28 Aug 2005 12:05:07 -0700, you wrote: >Newbie to RegEx so though I would start with something really easy. My big >mistake > > > >Problem > >If the string does not contain a trailing \ then add one. $string .= "\\" unless $string =~ /\\$/; or, if you prefer, $string .= "\\" if $string

RE: regex and map()

2005-05-09 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: > Im trying to sort out why the last line in the routine tokenizer() > fails to strip off the trailing double quote for all but the last > token. > > AFAICT, none of the tokens have any newlines - so I'm at a loss as to > why it does not do what is expected - (this functi

Re: Regex

2005-04-16 Thread $Bill Luebkert
Jim Hansen wrote: > Sorry. Lousy explanation. I have a string that will have > PSserver01...02, etc. I need to check for this string: > > $Printserver = "HP4000 [PSserver01]" > > I guess this can be as simple as > > $Printserver = "HP4000 [PSserver01]" > > if ( ! /PSserver/ ) {

RE: Regex

2005-04-16 Thread Robert Johnson
Jim Hansen wrote: > THat's not doing it either. For some reason, when it > is compiled, that line is ignored. > sorry, i missed the part where you said it was working as a script, but not as a compiled executable. I don't use the ActiveState compiler, and don't know why that would be happeni

RE: Regex

2005-04-16 Thread Jim Hansen
THat's not doing it either. For some reason, when it is compiled, that line is ignored. --- Robert Johnson <[EMAIL PROTECTED]> wrote: > Jim Hansen wrote: > > > > $name = 'HP4000 [PSserver01]'; > > if ( $name =~ /[PSserver/ ) { > > next; > > } > > running this straight as a script with the '-d'

RE: Regex

2005-04-16 Thread Robert Johnson
Jim Hansen wrote: > > $name = 'HP4000 [PSserver01]'; > if ( $name =~ /[PSserver/ ) { > next; > } > running this straight as a script with the '-d' switch > or without, it works fine, but if I compile it and run > it, for some reason it is ignored and I end up with my > issue. IS there a better wa

RE: Regex

2005-04-16 Thread Jim Hansen
Thanks for all the great ideas. What I decided to do was just check for '[PSserver' because this part is causing me issues and it isn't needed. In my script I have writtern as such. I would like to split the two apart, but can just do a next and ignore it for now. $name = 'HP4000 [PSserver01]';

RE: Regex

2005-04-16 Thread Robert Johnson
Jim Hansen wrote: > > Sorry. Lousy explanation. I have a string that will have > PSserver01...02, etc. I need to check for this string: > > $Printserver = "HP4000 [PSserver01]" > > I guess this can be as simple as > > $Printserver = "HP4000 [PSserver01]" > if ( ! /PSserver/ ) { > do > }

Re: Regex

2005-04-16 Thread Jim Hansen
Sorry.  Lousy explanation.  I have a string that will have PSserver01...02, etc.  I need to check for this string:   $Printserver = "HP4000 [PSserver01]"   I guess this can be as simple as   $Printserver = "HP4000 [PSserver01]" if ( ! /PSserver/ ) { do } Thanks $Bill Luebkert <[EMAIL PROTECTED]> w

RE: Regex

2005-04-16 Thread Bullock, Howard A.
You do not say what you want to do with the line or the value for which you are searching. You also do specify if “xx” is only numeric or not. But anyway…   if ($String =~ /PSserver../){   #do something… }   if ($String =~ /PSserver\d\d/){   #do something… }   You should checkout

Re: Regex

2005-04-15 Thread $Bill Luebkert
Jim Hansen wrote: > I need to parse a string with a specific phrase within it. > > For example: > > "PSserverxx" > > What is the best way to do this? Insufficient explanation. What do you mean by parse ? Are you trying to see if that substr is in the string or what ? Show examples of wha

RE: regex confusion...

2005-02-22 Thread Peter Eisengrein
I broke it with brackets, parenthetically speaking. Thanks all - simple mind making a simple mistake. -Original Message- From: Peter Eisengrein [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 5:05 PM To: 'Perl-Win32-Users Mailing List (E-mail)' Subject: RE: regex

RE: regex confusion...

2005-02-21 Thread Tom Pollard
On Mon, 21 Feb 2005, Peter Eisengrein wrote: > sorry about that. a bit too quick on the trigger finger. I have the > following: > > @files = grep { /^ccs_[cas|pri|atsm]/ && -f "$dir/$_" } readdir(DIR); > > There are other files in $dir that start with ccs but I only want ccs_cas > ccs_pri or ccs

RE: regex confusion...

2005-02-21 Thread cassell . david
Peter Eisengrein <[EMAIL PROTECTED]> wrote: > sorry about that. a bit too quick on the trigger finger. I have the following: No problem. A little fat-fingering happens now and then. > @files = grep { /^ccs_[cas|pri|atsm]/ && -f "$dir/$_" } readdir(DIR); > > There are other files in $dir that sta

RE: regex confusion...

2005-02-21 Thread Chris Snyder
Try changing the square brackets to parentheses.   -Original Message- From: Peter Eisengrein [mailto:[EMAIL PROTECTED] Sent: Monday, February 21, 2005 4:05 PM To: 'Perl-Win32-Users Mailing List (E-mail)' Subject: RE: regex confusion...   sorry about that. a bit to

RE: regex confusion...

2005-02-21 Thread Peter Eisengrein
sorry about that. a bit too quick on the trigger finger. I have the following:   @files = grep { /^ccs_[cas|pri|atsm]/ && -f "$dir/$_" } readdir(DIR); There are other files in $dir that start with ccs but I only want ccs_cas ccs_pri or ccs_atsm but for some reason it seems to also match a fi

RE: Regex Help

2005-01-27 Thread Dirk Bremer
Sent: 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 ther

RE: Regex Help

2005-01-27 Thread Lloyd Sartor
        To:        <[EMAIL PROTECTED]>,         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) {  

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

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

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 co

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 l

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

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] =~/^(.*?,){3

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

RE: Regex question: Multiple instances of the same character

2004-11-08 Thread Ted Schuerzinger
Joseph Discenza graced perl with these words of wisdom: > I haven't seen anyone recommend this: /T.*T/i to match two 'T's. I'm not > going to compare this to $Bill's word-matching routine :). That's such a simple solution, and it seems to work. In a previous post, I wrote: > As an example, sup

RE: Regex question: Multiple instances of the same character

2004-11-08 Thread Joseph Discenza
Ted Schuerzinger wrote, on Saturday, November 06, 2004 3:29 PM : I'm an avid, but not very good, Scrabble player. Last night, I was : playing, and suffered a major brain cramp when I got a rack : of four vowels : *and* two blanks: AEIUR**. I couldn't come up with anything : at the time

Re: Regex question: Multiple instances of the same character

2004-11-07 Thread Ted Schuerzinger
$Bill Luebkert graced perl with these words of wisdom: > Outer: Hmm I don't understand what the lines "Outer:" and "next Outer;" do. > while () { > if (/^[a-z]{7}$/i) { > > my $word = $_; > foreach (qw(a e r s t t t)) { >if (not $word =~ s/$_//i) {

Re: Regex question: Multiple instances of the same character

2004-11-07 Thread Ted Schuerzinger
Glenn Linderman graced perl with these words of wisdom: > Maybe Ted doesn't care about the performance of repeated similar > queries. Depends on if he's "cheating in real time", or just > occasionally wants to check a word. But he did mention the word > "efficient" in the original posting. N

Re: Regex question: Multiple instances of the same character

2004-11-06 Thread $Bill Luebkert
Glenn Linderman wrote: > It looks like you're assuming the 8th letter must be at the beginning or > end of the 7 letters on the rack. However, depending on the open space > on the board, the 8th letter (already on the board) could really be > placed at any position in the resulting 8 letter wo

Re: Regex question: Multiple instances of the same character

2004-11-06 Thread $Bill Luebkert
Glenn Linderman wrote: > On approximately 11/6/2004 8:48 PM, came the following characters from > the keyboard of $Bill Luebkert: > >>Glenn Linderman wrote: >> >> >> >>>Let's say you had AERSTTT in your rack (yep, that's the thing that >>>holds the tiles). Now, clearly that matches the wor

Re: Regex question: Multiple instances of the same character

2004-11-06 Thread $Bill Luebkert
Ted Schuerzinger wrote: > $Bill Luebkert graced perl with these words of wisdom: > > >>Ted Schuerzinger wrote: >> >> >>>I'm an avid, but not very good, Scrabble player. Last night, I was >>>playing, and suffered a major brain cramp when I got a rack of four >>>vowels *and* two blanks: AEIUR*

Re: Regex question: Multiple instances of the same character

2004-11-06 Thread $Bill Luebkert
Glenn Linderman wrote: > Let's say you had AERSTTT in your rack (yep, that's the thing that > holds the tiles). Now, clearly that matches the word "tatters". But > how would you make the regex that finds it, but doesn't find "batters", > "matters", "hatters", "patters", and even "praters"

Re: Regex question: Multiple instances of the same character

2004-11-06 Thread Ted Schuerzinger
$Bill Luebkert graced perl with these words of wisdom: > Ted Schuerzinger wrote: > >> I'm an avid, but not very good, Scrabble player. Last night, I was >> playing, and suffered a major brain cramp when I got a rack of four >> vowels *and* two blanks: AEIUR**. I couldn't come up with anythin

Re: Regex question: Multiple instances of the same character

2004-11-06 Thread $Bill Luebkert
Ted Schuerzinger wrote: > I'm an avid, but not very good, Scrabble player. Last night, I was > playing, and suffered a major brain cramp when I got a rack of four vowels > *and* two blanks: AEIUR**. I couldn't come up with anything at the time, > so this morning wrote a simple Perl script

RE: regex in <>

2004-11-05 Thread Tom Pollard
On Fri, 5 Nov 2004, Beckett Richard-qswi266 wrote: > use strict; > use warnings; > my $pat = "abcdijklmnopuvwxyz"; > print "\$pat is $pat\n"; > $pat =~ /<(.*)>.*<(.*)>/; > my ($one, $two) = ($1, $2); > print "\$one is $one\n\$two is $two\n"; That does work in this case, but it's not terribly robus

Re: regex in <>

2004-11-05 Thread $Bill Luebkert
Beckett Richard-qswi266 wrote: > use strict; > use warnings; > my $pat = "abcdijklmnopuvwxyz"; > print "\$pat is $pat\n"; > $pat =~ /<(.*)>.*<(.*)>/; You probably want to either make that non-greedy or use a different expression in case there are more <> in the string : /<(.*?)>.*<(.*?)>

RE: regex in <>

2004-11-05 Thread Beckett Richard-qswi266
use strict; use warnings; my $pat = "abcdijklmnopuvwxyz"; print "\$pat is $pat\n"; $pat =~ /<(.*)>.*<(.*)>/; my ($one, $two) = ($1, $2); print "\$one is $one\n\$two is $two\n"; R. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Jutu Subramanian,

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

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 Ne

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

RE: Regex matching of patterns in variables

2004-03-03 Thread Ted S.
Steven Manross graced perl with these words of wisdom: > R U sure it's not the while loop.. I've never seen that incantation > b4.. But that's not surprising.. I'm not the most traveled perler.. That while loop is how you process a file line by line. -- Ted Schuerzinger The way I see it, y

RE: Regex matching of patterns in variables

2004-03-03 Thread Wagner, David --- Senior Programmer Analyst --- WGO
hey all, Scratchin' my head on this one for a couple of hours now, looking at camels. sheep and other documentation creatures to no avail. I'm trying to match a pattern that's already (must be) in a variable like so: $var = "coyote"; while () { if ($_ =~ /$var/i) { print $_ . " matches\

Re: Regex matching of patterns in variables

2004-03-03 Thread John Deighan
At 04:58 PM 3/3/2004, Moulder, Glen wrote: hey all, Scratchin' my head on this one for a couple of hours now, looking at camels. sheep and other documentation creatures to no avail. I'm trying to match a pattern that's already (must be) in a variable like so: $var = "coyote"; while () { if (

RE: Regex matching of patterns in variables

2004-03-03 Thread Steven Manross
That works (with the for loop instead of the while)... @vars = ("coyote","fish","Wile E. Coyote"); $var = "coyote"; #foreach () { foreach (@vars) { if ($_ =~ /$var/i) { print $_ . " matches\n"; }; } Outputs: coyote matches Wile E. Coyote matches R U sure it's not the while loop.. I'v

Re: Regex matching of patterns in variables

2004-03-03 Thread Andy_Bach
Works fine here - 'course the '.' in Wile E. is going to match any char so: Wile E. Coyote matches Wile Ej Coyote matches Wile E. Coyotexxx matches using quotemeta or \Q: #my $var = "coyote"; my $var = quotemeta "Wile E. Coyote"; while () { if ( /$var/oi) { print $_ . " matches\n"; }

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

Re: REGEX help!

2004-01-13 Thread Mike Jackson
ced clarity. Happy learning. - 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 Subjec

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:

Re: REGEX help!

2004-01-13 Thread Glenn Linderman
t removes the complex redundancy, and can be expressed in half the lines even with the enhanced clarity. Happy learning. - Original Message - From: "Glenn Linderman" <[EMAIL PROTECTED]> To: "Jamie Murray" <[EMAIL PROTECTED]> Cc: "$Bill Luebkert" &

Re: REGEX help!

2004-01-13 Thread Jamie Murray
.$octet\.$octet\.$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 PROTECT

Re: REGEX help!

2004-01-13 Thread Glenn Linderman
; <[EMAIL PROTECTED]> Sent: Tuesday, January 13, 2004 9:40 AM 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&#x

  1   2   >