in reply to Re: Find string match
in thread Find string match

Not quite
($tablename) = $str=~/\binto\s+([\S]+)/; Updated: on foot of cdarke's observations below

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^3: Find string match
by cdarke (Prior) on Feb 23, 2010 at 13:18 UTC
    Not quite
    The match returns 1 (true). Maybe you are thinking of s?
    $str=~/\binto\s+(\S+)/; my $tablename = $1;
    [^\s] is better written as \S
      Actually 1 is the size of the array of matches.

      print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
Re^3: Find string match
by cdarke (Prior) on Feb 23, 2010 at 14:22 UTC
    Or maybe:
    my $tablename = ($str=~/\binto\s+([^\s]+)/)[0];

      Less obscure:

      $s = 'insert into table1 ( v1, v2 , v3) values ( v1, v2, v3)';; ( $tname ) = $s =~ m[into\s+(\S+)\s?\(]; print $tname;; table1

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.