Re: escaping regex to do math on backreferences

2009-04-13 Thread Chas. Owens
On Mon, Apr 13, 2009 at 06:12, Gunnar Hjalmarsson wrote: snip >> Also, if you make that change you need to check the for loop as well: >> >> for my $i (0 .. 10) { > > Actually no. > > $ perl -wle ' > @rank = qw/A 2 3 4 5 6 7 8 9 10 J Q K A/; > print map $_."[cdhs]", @rank[10..10+4]; > ' > Use of u

Re: escaping regex to do math on backreferences

2009-04-13 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Sun, Apr 12, 2009 at 21:58, Gunnar Hjalmarsson wrote: Chas. Owens wrote: my @rank = qw/ 2 3 4 5 6 7 8 9 10 J Q K A /; my @rank = qw/A 2 3 4 5 6 7 8 9 10 J Q K A /; --^ snip That depends on who you play with. Ok. Also, if you make that change you

Re: escaping regex to do math on backreferences

2009-04-12 Thread Chas. Owens
On Sun, Apr 12, 2009 at 21:58, Gunnar Hjalmarsson wrote: > Chas. Owens wrote: >> >> my @rank = qw/ 2 3 4 5 6 7 8 9 10 J Q K A /; > >    my @rank = qw/A 2 3 4 5 6 7 8 9 10 J Q K A /; > --^ snip That depends on who you play with. Also, if you make that change you need to check the

Re: escaping regex to do math on backreferences

2009-04-12 Thread Gunnar Hjalmarsson
Chas. Owens wrote: my @rank = qw/ 2 3 4 5 6 7 8 9 10 J Q K A /; my @rank = qw/A 2 3 4 5 6 7 8 9 10 J Q K A /; --^ -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail

Re: escaping regex to do math on backreferences

2009-04-12 Thread Chas. Owens
On Sun, Apr 12, 2009 at 18:34, Andrew Fithian wrote: > Hello everyone, > I have a program that needs to find straights in a hand of cards. The hand > is a string with no whitespace sorted by the cards' ranks, eg "9d10cJhQsKd". > How can I identify if that hand contains a straight with a single reg

Re: escaping regex to do math on backreferences

2009-04-12 Thread Gunnar Hjalmarsson
Andrew Fithian wrote: I have a program that needs to find straights in a hand of cards. Only straights? The hand is a string with no whitespace sorted by the cards' ranks, eg "9d10cJhQsKd". How can I identify if that hand contains a straight with a single regex? Why on earth would you want

escaping regex to do math on backreferences

2009-04-12 Thread Andrew Fithian
Hello everyone, I have a program that needs to find straights in a hand of cards. The hand is a string with no whitespace sorted by the cards' ranks, eg "9d10cJhQsKd". How can I identify if that hand contains a straight with a single regex? Is that even possible? Is there a way to escape the regex

Re: Regex to do ///?

2004-07-26 Thread Gunnar Hjalmarsson
Ian Marlier wrote: Given a string that looks like this: "This is a (string of words) that go together" I need to turn it into this: "This is a (stringofwords) that go together" Which is to say, I need to match one set of characters (the parentheses) and then do a reg-ex operation on another (the sp

Re: Regex to do ///?

2004-07-26 Thread James Edward Gray II
On Jul 26, 2004, at 8:17 PM, Ian Marlier wrote: Hi, all -- I've got another RegEx question, a follow-up to one that I asked earlier today: Given a string that looks like this: "This is a (string of words) that go together" I need to turn it into this: "This is a (stringofwords) that go together"

Regex to do ///?

2004-07-26 Thread Ian Marlier
Hi, all -- I've got another RegEx question, a follow-up to one that I asked earlier today: Given a string that looks like this: "This is a (string of words) that go together" I need to turn it into this: "This is a (stringofwords) that go together" Which is to say, I need to match one set of ch