[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] Need Regrx



Elton Hughes wrote:
> 
> Hello Listers,
> 
> I am having a very down day. I have a variable:
> 
> my $stmt = "select * from projects where proj_id = \"1\"";
> 
> I need to extract everything after the word where.
> 
> HELP! For the life of me, I cannot figure this one out. I have the Camel 
> and the Ram books next to me, but I am so depressed (my G3 PowerBook went 
> into the shop last week :-( ) I cannot think straight.
> 

($everything_after_the_word_where) = $stmt =~ /where(.*)/s;

or

$pos = index $stmt, 'where';
$everything_after_the_word_where = substr $stmt, $pos + length 'where'
  if $pos >= 0;



Ronald

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org