I see. Thank you!!
But if I match the other way round, let say I have such a sentence:
$sentence = "Boy NN
wants VB
to TO
take VB
note NN";
I want to match the nearest verb before the noun "note NN".
the code is like this:
============================
$phrase = "note NN";
if ($sentence =~ /(\w+\sVB)*(.|\n)*?($phrase)/ {
$node = $1.$3;
print $node;
}
============================
However, this gives me $1 = wants, instead of the one I want: "take".
Is there any way to solve this problem? Besides, how to match the
regexp from the end the string? Thanks!!