Re: Please Remove From List
Le 09/01/2020 à 17:26, Derek Jones a écrit : To whom it may concern, Please remove this email address (Derek Jones) from the modperl email list. Thanks! Hi, have a look at: http://perl.apache.org/maillist/modperl.html#toc_Subscription_Information You have to send a mail to 'modperl-unsubscr...@perl.apache.org'. CJ
Please Remove From List
To whom it may concern, Please remove this email address (Derek Jones) from the modperl email list. Thanks!
Re: how to run regex calculation
It probably won't ever work. The problem is the * (star/asterisk) after \1 is being interpreted in the context of regular expressions, ie, "zero-or-more matches", and not as a multiplication operator. In fact, ~]$ perl -Mstrict -le 'my $str = "2 3 23"; print "true" if $str=~/(\d+)\s(\d+)\s(\1*\2)/' ...does indeed print "true" It would probably make the most sense to not try to do this as a one-liner (why do we perl programmers love to be cute like that?), and simply break it up into two steps: $str =~ s/(\d+)\s(\d+)\s(\d+)/; print "true" if ($1*$2 == $3); - Michael On 1/9/2020 12:39 AM, Wesley Peng wrote: Hallo on 2020/1/9 16:35, demerphq wrote: $str=~/(\d+)\s(\d+)\s(\1*\2)/ $1 refers to the capture buffers from the last completed match, \1 inside of the pattern part of a regex refers to the capture buffer of the currently matching regex. This doesn't work too. perl -Mstrict -le 'my $str = "2 3 6"; print "true" if $str=~/(\d+)\s(\d+)\s(\1*\2)/' nothing printed. Regards.
Re: DB connection pool management
I don't know which database you're using but we use Apache::DBI + PGBouncer On Thu, Jan 9, 2020 at 1:08 AM Mithun Bhattacharya wrote: > Connection pooling is implemented in DBI and enabled on need basis and in > Apache::DBI it is enabled by default. > > On Wed, Jan 8, 2020 at 9:04 PM Wesley Peng wrote: > >> Hallo >> >> Is there DB connection pool management library like JDBC for mod_perl? >> I know there is Apache::DBI, but that seems not the one who have pool >> capability. >> >> Thanks & happy new year. >> >> Regards. >> > -- John Dunlap *CTO | Lariat * *Direct:* *j...@lariat.co * *Customer Service:* 877.268.6667 supp...@lariat.co
Re: how to run regex calculation
On Thu, Jan 09, 2020 at 05:21:38PM +0800, Wesley Peng wrote: > what does (??{$1*$2}) means? Check the perlre(1) man page for explanation of "(??{ code })". As already mentioned, other venues like Perlmonks might serve better for the generic Perl questions. -- Jan Pazdziora
Re: how to run regex calculation
what does (??{$1*$2}) means? Thanks. on 2020/1/9 12:49, Joseph He wrote: I think $str =~ /(\d+)\s(\d+)\s(??{$1*$2})/ should do it My Perl version is v5.26.1
Re: how to run regex calculation
My apologies you were right. I misunderstood the question. Yves On Thu, 9 Jan 2020, 09:39 demerphq, wrote: > On Thu, 9 Jan 2020 at 05:49, Joseph He wrote: > > > > I think $str =~ /(\d+)\s(\d+)\s(??{$1*$2})/ should do it > > My Perl version is v5.26.1 > > I think you mean (??{ "$1*$2"}) which might work, but it will be error > prone, (??{"(?$1)*$2") would be better, but both will be slow, as each > time a new pattern willbe compiled. > > /(\d+)\s(\d+)\s(\1*\2)/ > > just works, and does not recompile the pattern over and over. Look for > "back references" in perlre. > > Yves >
Re: how to run regex calculation
Oh. Heh. I misunderstood the intent. I thought you wanted to match a sequence of digits followed by a space followed by more digits followed by a space followed by the first set of digits repeated 0 or more times followed by the second set of digits. If you want multiplication then Joseph He's original answer was correct. Yves On Thu, 9 Jan 2020, 09:40 Wesley Peng, wrote: > Hallo > > on 2020/1/9 16:35, demerphq wrote: > > $str=~/(\d+)\s(\d+)\s(\1*\2)/ > > > > $1 refers to the capture buffers from the last completed match, \1 > > inside of the pattern part of a regex refers to the capture buffer of > > the currently matching regex. > > This doesn't work too. > > perl -Mstrict -le 'my $str = "2 3 6"; print "true" if > $str=~/(\d+)\s(\d+)\s(\1*\2)/' > > nothing printed. > > > Regards. >
Re: how to run regex calculation
Hallo on 2020/1/9 16:35, demerphq wrote: $str=~/(\d+)\s(\d+)\s(\1*\2)/ $1 refers to the capture buffers from the last completed match, \1 inside of the pattern part of a regex refers to the capture buffer of the currently matching regex. This doesn't work too. perl -Mstrict -le 'my $str = "2 3 6"; print "true" if $str=~/(\d+)\s(\d+)\s(\1*\2)/' nothing printed. Regards.
Re: how to run regex calculation
On Thu, 9 Jan 2020 at 05:49, Joseph He wrote: > > I think $str =~ /(\d+)\s(\d+)\s(??{$1*$2})/ should do it > My Perl version is v5.26.1 I think you mean (??{ "$1*$2"}) which might work, but it will be error prone, (??{"(?$1)*$2") would be better, but both will be slow, as each time a new pattern willbe compiled. /(\d+)\s(\d+)\s(\1*\2)/ just works, and does not recompile the pattern over and over. Look for "back references" in perlre. Yves
Re: how to run regex calculation
This isnt really the forum for random perl help, i suggest Perlmonks instead. $str=~/(\d+)\s(\d+)\s(\1*\2)/ $1 refers to the capture buffers from the last completed match, \1 inside of the pattern part of a regex refers to the capture buffer of the currently matching regex. Yves On Thu, 9 Jan 2020 at 03:36, Wesley Peng wrote: > > Hello > > Give the case I have a string, > > $str = "2 3 6"; > > I want to match with: > > true if $str =~ /(\d+)\s(\d+)\s($1*$2)/; > > that's to say, the thrid column would be (firstCol * SecondCol). > > How to write regex for this? > > Thank you. -- perl -Mre=debug -e "/just|another|perl|hacker/"