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

Re: Escaping a plus sign

2006-05-31 Thread Dr.Ruud
Paul Nowosielski schreef: > The > script will die if the is a + sign in the fields its parsing. perldoc -f quotemeta -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Escaping a plus sign

2006-05-31 Thread Ken Lehman
Is it the if ($MGMTCMNT =~ /$MGMTNM/) part that is tripping you up? I believe you could change it to if ($MGMTCMNT =~ /\Q$MGMTNM\E/) if you need to keep the regular expression. Another idea might be to change it to if ( ($start = index($MGMTCMNT, "$MGMTNM (")) > 0) { -Original Message-

Re: Escaping a plus sign

2006-05-30 Thread John W. Krahn
Paul Nowosielski wrote: > Dear All, Hello, > I have a perl script that runs nightly. It create a data feed. The script > will > die if the is a + sign in the fields its parsing. > > Here is the snippet: > > while (($PKEY, $MGMTCMNT, $manager_id, $MGMTNM, $UPDATE1, $UPDATE2) = > $sth->fetchro

Re: Escaping a plus sign

2006-05-30 Thread Paul Nowosielski
So would this be the correct solution: while (($PKEY, $MGMTCMNT, $manager_id, $MGMTNM, $UPDATE1, $UPDATE2) = $sth->fetchrow_array) { $comment = ""; # added to escape the plus sign $MGMTCMNT = ~ s/\+/\\+/g; $MGMTNM = ~ s/\+/\\+/g; if ($MGMTCMNT =~ /$MGMTN

Re: Escaping a plus sign

2006-05-30 Thread Anthony Ettinger
should probably escape the + sign with \+ $field =~ s/\+/\\+/g; On 5/30/06, Paul Nowosielski <[EMAIL PROTECTED]> wrote: Dear All, I have a perl script that runs nightly. It create a data feed. The script will die if the is a + sign in the fields its parsing. Here is the snippet: while (($PK

Re: Escaping large chunk of text for insertion into mysql

2006-02-01 Thread John Doe
Kevin Old am Mittwoch, 1. Februar 2006 13.44: > Hello everyone, > > I have a large chunk of data that I need to insert into a text or blob > field in mysql. I've tried all the usually escaping it, but nothing > seems to work. I'm even using dbh->quote as I thought it might help. > > Here's my cod

Re: Escaping with tr

2005-09-02 Thread Bernard van de Koppel
Hi, Thanks for the warning. As far as the specs are, a semicolon is not allowed as data in the datastream (yet) (of an electronic banking backend application). Some files however don't use the doublequote combined with the semicolon, but just the semicolon to identify fields. So far the se

Re: Escaping with tr

2005-08-30 Thread John W. Krahn
Bernard van de Koppel wrote: > Hi, Hello, > How can I get all the " characters out of a csv file. > > Input looks like > "bla bla";"bla bla";"bla bla" > > and it has to look like > bla bla;bla bla; bla bla > > I tried $text=~ tr(#\"##); $text =~ tr/"//d; John -- use Perl; program fulfillm

Re: Escaping with tr

2005-08-30 Thread Bernard van de Koppel
Hi, Thanks, this works great. Bernard On Tuesday 30 August 2005 23:23, Scott Taylor wrote: > > Hi, > > > > How can I get all the " characters out of a csv file. > > > > Input looks like > > "bla bla";"bla bla";"bla bla" > > > > and it has to look like > > bla bla;bla bla; bla bla > > > > I tried

Re: Escaping with tr

2005-08-30 Thread Scott Taylor
Wiggins d'Anconia said: > Scott Taylor wrote: I did not. >>>Hi, >>> >>>How can I get all the " characters out of a csv file. >>> >>>Input looks like >>>"bla bla";"bla bla";"bla bla" >>> >>>and it has to look like >>>bla bla;bla bla; bla bla >>> >>>I tried $text=~ tr(#\"##); >>>but perl keeps com

Re: Escaping with tr

2005-08-30 Thread Wiggins d'Anconia
Scott Taylor wrote: >>Hi, >> >>How can I get all the " characters out of a csv file. >> >>Input looks like >>"bla bla";"bla bla";"bla bla" >> >>and it has to look like >>bla bla;bla bla; bla bla >> >>I tried $text=~ tr(#\"##); >>but perl keeps complaining about "Might be a runaway multi-line ;;" >

Re: Escaping with tr

2005-08-30 Thread Scott Taylor
Bernard van de Koppel said: > Hi, > > How can I get all the " characters out of a csv file. > > Input looks like > "bla bla";"bla bla";"bla bla" > > and it has to look like > bla bla;bla bla; bla bla > > I tried $text=~ tr(#\"##); > but perl keeps complaining about "Might be a runaway multi-line

Re: Escaping with tr

2005-08-30 Thread Bernard van de Koppel
Eric, thanks for the response. After some fideling, I found a solution. $text=~ tr/\042/ /; Thanks. On Tuesday 30 August 2005 22:20, Eric Walker wrote: > On Tuesday 30 August 2005 04:16 pm, Bernard van de Koppel wrote: > > "bla bla";"bla bla";"bla bla" > > cat test.file | sed 's/\"//g' > editedf

Re: Escaping with tr

2005-08-30 Thread Wiggins d'Anconia
Eric Walker wrote: > On Tuesday 30 August 2005 04:16 pm, Bernard van de Koppel wrote: > >>"bla bla";"bla bla";"bla bla" > > > cat test.file | sed 's/\"//g' > editedfile Quick someone get the can of "UUoC Be Gone" ... ;-) http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For ad

Re: Escaping with tr

2005-08-30 Thread JupiterHost.Net
Eric Walker wrote: On Tuesday 30 August 2005 04:16 pm, Bernard van de Koppel wrote: "bla bla";"bla bla";"bla bla" cat test.file | sed 's/\"//g' > editedfile Good solution for sed list and if you like redirtecting from a pipe and using multiple program when unnecessary (do you also where

Re: Escaping with tr

2005-08-30 Thread Eric Walker
On Tuesday 30 August 2005 04:16 pm, Bernard van de Koppel wrote: > "bla bla";"bla bla";"bla bla" cat test.file | sed 's/\"//g' > editedfile -- Eric Walker EDA/CAD Engineer Work: 208-368-2573 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: escaping values (DBD::mysql)

2005-08-01 Thread Jeff 'japhy' Pinyan
On Jul 31, Octavian Rasnita said: select ... limit 0,30; but I cannot use: $sth = $dbh->prepare("select ... limit ?,?"); $sth->execute(0, 30); ... because DBI replaces the values entered with '0' and '30' and the query won't be valid. No, you probably can't do that because your SQL engine d

Re: escaping @

2005-07-19 Thread Charles Farinella
On Mon, 2005-07-18 at 11:53, Wiggins d'Anconia wrote: I had to add a 'chomp' and make sure the line endings in my file were correct, but this worked and I learned something useful as well. Thank you. :-) --charlie > Only do things in the loop that must be done in the loop. Reconnecting, > repr

Re: escaping @

2005-07-18 Thread Wiggins d'Anconia
Lawrence Statton wrote: >>On Mon, 2005-07-18 at 11:53, Wiggins d'Anconia wrote: >> >>>Charles Farinella wrote: >>> I'm sure this is very simple and I am overlooking something. I want to read a list of bad email addresses from a file and remove them from my database. If I pri

Re: escaping @

2005-07-18 Thread Wiggins d'Anconia
Charles Farinella wrote: > On Mon, 2005-07-18 at 11:53, Wiggins d'Anconia wrote: > >>Charles Farinella wrote: >> >>>I'm sure this is very simple and I am overlooking something. I want to >>>read a list of bad email addresses from a file and remove them from my >>>database. >>> >>>If I print $_,

Re: escaping @

2005-07-18 Thread Charles Farinella
On Mon, 2005-07-18 at 11:53, Wiggins d'Anconia wrote: > Charles Farinella wrote: > > I'm sure this is very simple and I am overlooking something. I want to > > read a list of bad email addresses from a file and remove them from my > > database. > > > > If I print $_, the email addresses are cor

Re: escaping @

2005-07-18 Thread Wiggins d'Anconia
Charles Farinella wrote: > I'm sure this is very simple and I am overlooking something. I want to > read a list of bad email addresses from a file and remove them from my > database. > > If I print $_, the email addresses are correct, if I try to remove them > from the db I get errors on just t

RE: escaping @

2005-07-18 Thread Moon, John
Subject: escaping @ I'm sure this is very simple and I am overlooking something. I want to read a list of bad email addresses from a file and remove them from my database. If I print $_, the email addresses are correct, if I try to remove them from the db I get errors on just the characters be

Re: escaping & in CGI.pm

2005-06-24 Thread Wiggins d'Anconia
Scott Taylor wrote: > Joshua Colson said: > >>Scott, >> >>You're trying to use an ampersand in your URL. Ampersands are special >>characters in URLs so you must escape it if you want it to be passed as >>the actual character instead of carrying the special meaning. >> >>See http://www.december.com

Re: escaping & in CGI.pm

2005-06-24 Thread Scott Taylor
Joshua Colson said: > Scott, > > You're trying to use an ampersand in your URL. Ampersands are special > characters in URLs so you must escape it if you want it to be passed as > the actual character instead of carrying the special meaning. > > See http://www.december.com/html/spec/esccodes.html

Re: escaping & in CGI.pm

2005-06-24 Thread Joshua Colson
Scott, You're trying to use an ampersand in your URL. Ampersands are special characters in URLs so you must escape it if you want it to be passed as the actual character instead of carrying the special meaning. See http://www.december.com/html/spec/esccodes.html On Fri, 2005-06-24 at 12:51 -0700

Re: Escaping

2004-04-08 Thread James Edward Gray II
On Apr 8, 2004, at 4:30 PM, [EMAIL PROTECTED] wrote: Is there any quick way of parsing a string like: This,Is,A,String,\,,With,A,Comma Into a list ("This", "Is", "A", "String", ",", "With, "A", "Comma") Basically, how can I split it by commas, except when it is escaped. How about: my @fields = sp

Re: Escaping Ampersands in XML

2003-01-16 Thread Ben Siders
Because of © I don't want that to get changed. In the end, something like: s/&(?!\w+|[#\d]+;/&/g Works. That might not be quite right, but I think you know what I'm getting at. Rob Dixon wrote: Jenda Krynicky wrote: Toby Stuart wrote: Try this one: s/&(?!\w+;)/&/g Proble

Re: Escaping Ampersands in XML

2003-01-16 Thread Rob Dixon
Jenda Krynicky wrote: >> Toby Stuart wrote: >>> Try this one: >>> >>> s/&(?!\w+;)/&/g > > Problem is that this will break things like > @ > Why not just: s/&(?!amp;)/&/g i.e. change every ampersand that isn't followed by 'amp;' into & Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: Escaping Ampersands in XML

2003-01-16 Thread Jenda Krynicky
> Toby Stuart wrote: > >Try this one: > > > > s/&(?!\w+;)/&/g Problem is that this will break things like @ Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. --

Re: Escaping Ampersands in XML

2003-01-16 Thread Ben Siders
Whew! That's the same one I finally came up with. Glad to see I was on the right track. The original solution didn't work at all. Toby Stuart wrote: -Original Message- From: Ben Siders [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 16, 2003 7:38 AM To: Perl Subject: Escaping Am

Re: Escaping Ampersands in XML

2003-01-16 Thread Jenda Krynicky
From: Ben Siders <[EMAIL PROTECTED]> > I've got a real easy one here (in theory). I have some XML files that > were generated by a program, but generated imperfectly. There's some > naked ampersands that need to be converted to &. I need a regexp > that will detect them and change them. Sounds

RE: Escaping Ampersands in XML

2003-01-15 Thread Toby Stuart
> -Original Message- > From: Ben Siders [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 16, 2003 7:38 AM > To: Perl > Subject: Escaping Ampersands in XML > > > I've got a real easy one here (in theory). I have some XML > files that > were generated by a program, but generated im

RE: Escaping characters

2002-06-04 Thread Barry Jones
To: Barry Jones; Beginners @ Perl (E-mail) Subject: RE: Escaping characters > -Original Message- > From: Barry Jones [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 04, 2002 1:15 PM > To: Beginners @ Perl (E-mail) > Subject: Escaping characters > > > Hi, >

RE: Escaping characters

2002-06-04 Thread Bob Showalter
> -Original Message- > From: Barry Jones [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 04, 2002 1:15 PM > To: Beginners @ Perl (E-mail) > Subject: Escaping characters > > > Hi, > I'm trying to do a patter match for everything contained within > {{ stuff }}. Now I've gotten th

Re: Escaping characters

2002-06-04 Thread Felix Geerinckx
on Tue, 04 Jun 2002 17:14:54 GMT, Barry Jones wrote: > Hi, > I'm trying to do a patter match for everything contained within > {{ stuff }}. Now I've gotten this to work just fine with ** stuff **, > ^^ and a several others, but I can't get curly braces to work and I have > no idea why. I'v

Re: Escaping HTML tags

2002-03-23 Thread bob ackerman
easiest i would think is here-doc. I like: open (OUTP, ">hdtst") or die "no can open\n"; print OUTP < > Severe newbie that would RTFM if I would have brought it home and i'm not > asking the right monestary search strings so i humbly ask for your help.. > . > > i'll go get going on a fresh pot o

Re: Escaping HTML tags

2002-03-23 Thread root
I'll gotta stop sending over-caffinated emails...wow, -w works... Scott Wahlstrom wrote: > Severe newbie that would RTFM if I would have brought it home and i'm not asking the >right monestary search strings so i humbly ask for your help... > > i'll go get going on a fresh pot of coffee.

Re: escaping v$session

2001-06-25 Thread Michael Fowler
On Mon, Jun 25, 2001 at 02:24:21PM -0400, Chas Owens wrote: > Let me see if I have this straight: > > Perl was ignoring $session because of the \ and then passing the output > to the shell (stripping the \). Yes. > The shell saw $session so it tried to replace it with the enviromental > varia

Re: escaping v$session

2001-06-25 Thread Chas Owens
On 25 Jun 2001 10:14:57 -0800, Michael Fowler wrote: > On Mon, Jun 25, 2001 at 02:09:59PM -0400, Chas Owens wrote: > > @active = qx( > > sqlplus -S $RTDUSER/$RTDPASS\@$RTD_ORACLE_SID <<-! > > select count(distinct(process)) ACTIVE from v\\\$session > > where last_call_et < 60 and > > process in (s

Re: escaping v$session

2001-06-25 Thread Michael Fowler
On Mon, Jun 25, 2001 at 02:09:59PM -0400, Chas Owens wrote: > @active = qx( > sqlplus -S $RTDUSER/$RTDPASS\@$RTD_ORACLE_SID <<-! > select count(distinct(process)) ACTIVE from v\\\$session > where last_call_et < 60 and > process in (select ltrim(rtrim(to_char(process_id) )) from > session_list); >

Re: escaping v$session

2001-06-25 Thread Chas Owens
On 25 Jun 2001 09:47:08 -0800, Michael Fowler wrote: > On Mon, Jun 25, 2001 at 01:09:51PM -0400, Chas Owens wrote: > > On 25 Jun 2001 12:57:39 -0400, Yacketta, Ronald wrote: > > > > select count(distinct(process)) ACTIVE from " . 'v$session' . " > > > > > select count(distinct(process)) ACTIVE fr

Re: escaping v$session

2001-06-25 Thread Michael Fowler
On Mon, Jun 25, 2001 at 01:09:51PM -0400, Chas Owens wrote: > On 25 Jun 2001 12:57:39 -0400, Yacketta, Ronald wrote: > > > select count(distinct(process)) ACTIVE from " . 'v$session' . " > > > select count(distinct(process)) ACTIVE from " . 'v\$session' . " > > What version of Perl are you using

RE: escaping v$session

2001-06-25 Thread Chas Owens
On 25 Jun 2001 12:57:39 -0400, Yacketta, Ronald wrote: > This one was really close :) > I had to change > > select count(distinct(process)) ACTIVE from " . 'v$session' . " > > to > > select count(distinct(process)) ACTIVE from " . 'v\$session' . " > > and it worked! > > Thanxs everyone! > > Ro

RE: escaping v$session

2001-06-25 Thread Yacketta, Ronald
This one was really close :) I had to change > select count(distinct(process)) ACTIVE from " . 'v$session' . " to > select count(distinct(process)) ACTIVE from " . 'v\$session' . " and it worked! Thanxs everyone! Ron

RE: escaping v$session

2001-06-25 Thread Stephen Neu
:@active = qx( :sqlplus -S $RTDUSER/$RTDPASS\@$RTD_ORACLE_SID <<-! :select count(distinct(process)) ACTIVE from ---> v$session <--- :where last_call_et < 60 and :process in (select ltrim(rtrim(to_char(process_id) )) from :session_list); :quit :! :); Oh... Didn't see the other variables you were

RE: escaping v$session

2001-06-25 Thread Chas Owens
On 25 Jun 2001 12:15:15 -0400, Yacketta, Ronald wrote: > this is what I am trying todo > > @active = qx( > sqlplus -S $RTDUSER/$RTDPASS\@$RTD_ORACLE_SID <<-! > select count(distinct(process)) ACTIVE from ---> v$session <--- > where last_call_et < 60 and > process in (select ltrim(rtrim(to_char(p

RE: escaping v$session

2001-06-25 Thread Stephen Neu
:@active = qx( :sqlplus -S $RTDUSER/$RTDPASS\@$RTD_ORACLE_SID <<-! :select count(distinct(process)) ACTIVE from ---> v$session <--- :where last_call_et < 60 and :process in (select ltrim(rtrim(to_char(process_id) )) from :session_list); :quit :! :); Ok, so you're using qx(foo), which is the same

RE: escaping v$session

2001-06-25 Thread Yacketta, Ronald
> -Original Message- > From: Stephen Neu [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 25, 2001 12:04 PM > To: Perl Beginners (E-mail) > Subject: RE: escaping v$session > > > Try 'v$session' instead of "v$session" > The single quot

RE: escaping v$session

2001-06-25 Thread Stephen Neu
Try 'v$session' instead of "v$session" The single quote doesn't interpolate variables like the double-quote. >From perldoc perlop Customary Interpolates '' no "" yes `` yes qw{}no // yes :-Original Message- :Fro