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 question: Vertical pipe in square brackets

2004-01-02 Thread Ted S.
Thomas, Mark - BLS CTR graced perl with these words of wisdom: > For the letter-substitution matches, why not create mini-re for each > one? > > $a = qr/[EMAIL PROTECTED]/; > $i = qr/[i1l\|]/; > > $str = "v|agr@"; > > if ($str =~ /v${i}${a}gr${a}/) { > #it's spam > } > Because Hamster d

Re: Regex question: Vertical pipe in square brackets

2004-01-02 Thread Rob Dixon
Mark Thomas wrote: > > > (i|1|l|\|) to kill the vertical pipe, but I find that much > > harder to read and more difficult to extend later on. > > For the letter-substitution matches, why not create mini-re for each one? > > $a = qr/[EMAIL PROTECTED]/; > $i = qr/[i1l\|]/; > > $str = "v|agr@"; >

RE: Regex question: Vertical pipe in square brackets

2004-01-02 Thread Thomas, Mark - BLS CTR
> (i|1|l|\|) to kill the vertical pipe, but I find that much > harder to read and more difficult to extend later on. For the letter-substitution matches, why not create mini-re for each one? $a = qr/[EMAIL PROTECTED]/; $i = qr/[i1l\|]/; $str = "v|agr@"; if ($str =~ /v${i}${a}gr${a}/) {

Re: Regex question.

2003-10-20 Thread Jingmei_Guo
You can use matching like this ... if ($stringToSplit =~ /Cat/)  {        print "found the string\n"; } [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/20/2003 09:49 AM                 To:        [EMAIL PROTECTED]         cc:                 Subject:        Regex question. Hi *,  

Re: Regex question

2003-02-06 Thread Carl Jolley
On Thu, 6 Feb 2003, Richard Morse wrote: > On 02/06/2003 2:09 PM, "Ben Gonzalez" <[EMAIL PROTECTED]> wrote: > > > All, > > > > I have a string that can contain any number from 0 to 1048575. > > > > I can verify that the numbers are digits like this: ^\d{1,7}$ > > > > The above regex matches any 1

Re: Regex question

2003-02-06 Thread Carl Jolley
On Thu, 6 Feb 2003, Ben Gonzalez wrote: > All, > > I have a string that can contain any number from 0 to 1048575. > > I can verify that the numbers are digits like this: ^\d{1,7}$ > > The above regex matches any 1 to 7 digits. It will ensure that the string > contains digits 0 to 999. > > I ne

Re: Regex Question: splitting at a point unless part of a quoted substring

2001-06-07 Thread $Bill Luebkert
Lee Goddard wrote: > > > Lee Goddard wrote: > > > > > > > > I need to split a string at all full-stops '.' > > > > > unless they are part of a sub-string within quotes. > > > > > > > > > > Should I manually loop over the file, setting flags, > > > > > or can I do this with a regular expression? >

RE: Regex Question: splitting at a point unless part of a quoted substring

2001-06-07 Thread Lee Goddard
> Lee Goddard wrote: > > > > > > I need to split a string at all full-stops '.' > > > > unless they are part of a sub-string within quotes. > > > > > > > > Should I manually loop over the file, setting flags, > > > > or can I do this with a regular expression? > > > > > > And of course, I need to

Re: Regex Question: splitting at a point unless part of a quoted substring

2001-06-07 Thread $Bill Luebkert
Lee Goddard wrote: > > > > I need to split a string at all full-stops '.' > > > unless they are part of a sub-string within quotes. > > > > > > Should I manually loop over the file, setting flags, > > > or can I do this with a regular expression? > > > > And of course, I need to have escaped sing

RE: Regex Question: splitting at a point unless part of a quoted substring

2001-06-07 Thread Lee Goddard
> > I need to split a string at all full-stops '.' > > unless they are part of a sub-string within quotes. > > > > Should I manually loop over the file, setting flags, > > or can I do this with a regular expression? > > And of course, I need to have escaped single-quotes too, > \' In other wor

RE: Regex Question: splitting at a point unless part of a quoted substring

2001-06-07 Thread Lee Goddard
> I need to split a string at all full-stops '.' > unless they are part of a sub-string within quotes. > > Should I manually loop over the file, setting flags, > or can I do this with a regular expression? And of course, I need to have escaped single-quotes too, \' Thanks in anticipation... l

RE: Regex Question: splitting at a point unless part of a quoted substring

2001-06-07 Thread erskine, michael
> -Original Message- > From: Lee Goddard [mailto:[EMAIL PROTECTED]] > Sent: 07 June 2001 11:14 > To: Perl_Users > Subject: Regex Question: splitting at a point unless part of a quoted > substring > I need to split a string at all full-stops '.' > unless they are part of a sub-string with

Re: Regex Question

2001-05-03 Thread $Bill Luebkert
"[EMAIL PROTECTED]" wrote: > > Hi, how can I rewrite this so it's more efficient? Thanks!!! > > -Tha > > $s = "13:01:13 HTTP request from FiskNT for > www.bostonphoenix.com/portal/boston/monday.html; result = 200 OK"; > > $s =~ m/(\d\d:\d\d).*from (\w+) for (.*\.[a-zA-z]+)\/(.*);/; > $time = $

Re: Regex Question

2001-05-03 Thread Grant Hopwood
-start- > "[EMAIL PROTECTED]" at05/03/2001 12:44 PM >Hi, how can I rewrite this so it's more efficient? Thanks!!! If every log entry is the *same* format... >$s = "13:01:13 HTTP request from FiskNT for >www.bostonphoenix.com/portal/boston/monday.html; result = 200 OK"; >$s =~ m/(\d\d:\d

Re: Regex Question

2001-05-03 Thread Carl Jolley
On Thu, 3 May 2001, [EMAIL PROTECTED] wrote: > Hi, how can I rewrite this so it's more efficient? Thanks!!! > > > $s = "13:01:13 HTTP request from FiskNT for > www.bostonphoenix.com/portal/boston/monday.html; result = 200 OK"; > > $s =~ m/(\d\d:\d\d).*from (\w+) for (.*\.[a-zA-z]+)\/(.*);/; > $ti

RE: Regex Question

2001-05-03 Thread Peter Eisengrein
($time,$user,$rooturl,$suburl) =~ m/(\d{2}:\d{2}).*from (\w+) for (.*\.[a-zA-z]+)\/(.*);/; not a lot better... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 03, 2001 1:44 PM To: [EMAIL PROTECTED] Subject: Regex Question Hi, how can I rewrite

Re: Regex Question

2001-01-02 Thread Joel Ricker
>I would like a regex to replace leading zeroes in a number. For example, a >ten-digit number string has 5 leading (leftmost) zeroes. I would like to >replace each leading zero with a space, i.e. 5 leading zeroes with 5 leading >spaces. I tried s/^0+/ /g but it replaced all leading zeroes with on

Re: Regex Question

2001-01-02 Thread Joel Ricker
>I would like a regex to replace leading zeroes in a number. For example, a >ten-digit number string has 5 leading (leftmost) zeroes. I would like to >replace each leading zero with a space, i.e. 5 leading zeroes with 5 leading >spaces. I tried s/^0+/ /g but it replaced all leading zeroes with on