Regex sending me mad

2012-07-27 Thread Gary Stainburn
Hi folks. I'm struggling to see what I'm doing wrong. I have the following code in one of my programs but it isn't working as it should. print STDERR enqmake='$enqmake' model='$model'\n; if (!$enqmake $model) { # extract make print STDERR About to split '$model'\n; if ($model=~/ *?(\w*)

Re: Regex sending me mad

2012-07-27 Thread Jim Gibson
On Jul 27, 2012, at 7:04 AM, Gary Stainburn wrote: Hi folks. I'm struggling to see what I'm doing wrong. I have the following code in one of my programs but it isn't working as it should. print STDERR enqmake='$enqmake' model='$model'\n; if (!$enqmake $model) { # extract make

Re: Regex sending me mad

2012-07-27 Thread Shawn H Corey
On Fri, 27 Jul 2012 07:29:13 -0700 Jim Gibson jimsgib...@gmail.com wrote: Why aren't you using the split function? ($model,$engmake) = split(' ',$model); That would be: ($model,$engmake) = split(' ',$model, 2); See `perldoc -f split` for details. -- Just my 0.0002 million

Re: Regex sending me mad

2012-07-27 Thread Andy Bach
On Fri, Jul 27, 2012 at 9:04 AM, Gary Stainburn gary.stainb...@ringways.co.uk wrote: print STDERR About to split '$model'\n; if ($model=~/ *?(\w*) (.*?) *$/) { $enqmake=lc($1); $model=$2; print STDERR model split into '$enqmake' '$model'\n; } } # extract make This

Re: Regex sending me mad

2012-07-27 Thread Dr.Ruud
On 2012-07-27 16:58, Andy Bach wrote: if ($model=~/(\S+)\s+(.*)\s*$/) { The \s* in the end does nothing. Closer: /(\S+)\s+(.*\S)/ Then play with this: perl -Mstrict -we' my $data= $ARGV[0] ? q{Ford} : qq{ \t Fiat Ulysse 2.1 TD}; printf qq{%s %s\n}, split( q{ }, $data, 2 ),

SOLVED Re: Regex sending me mad

2012-07-27 Thread Gary Stainburn
On Friday 27 July 2012 15:58:07 Andy Bach wrote: Your RE is a bit odd - all that 'non-greedy *' -ness implies troubles. The first space star ? can be greedy, right? You want all the spaces/white space in a row, or rather don't want - as you're anchored on the end, this doesn't do anything

Re: Regex sending me mad

2012-07-27 Thread Andy Bach
On Fri, Jul 27, 2012 at 10:22 AM, Dr.Ruud rvtol+use...@isolution.nl wrote: On 2012-07-27 16:58, Andy Bach wrote: if ($model=~/(\S+)\s+(.*)\s*$/) { The \s* in the end does nothing. Well, I was thinking if it's a multi-word second match: v6 Austin Martinspacespace Then that would matches

Script to test connecting to Oracle DBs

2012-07-27 Thread newbie01 perl
Hi all, I am looking for a Perl script or something similar that I can use to test connection from a client PC to several databases on a server. Does anyone know of any such script lying around somewhere :(- Currently, am testing connection from a client PC to an Oracle DB using Oracle's

Re: Script to test connecting to Oracle DBs

2012-07-27 Thread Rob Dixon
On 28/07/2012 02:45, newbie01 perl wrote: Hi all, I am looking for a Perl script or something similar that I can use to test connection from a client PC to several databases on a server. Does anyone know of any such script lying around somewhere :(- Currently, am testing connection from