in reply to Regexp Substitution Problem!!

Oh, I think I find the answer. The problem should be with the string, in the first post the string should cause no problem

$sentence = " he PP study VB A~~~language~A NP and CC play VB A~~~game~A NP ."

but if I change the string into this

$sentence = " he PP study VB A~~~language~A NP and CC play VB A~~~(G|g)ames?~A NP ."

because /(G|g)ames?/ matches Games, Game, games, game, but it will not match "(G|g)ames?". I think that's the reason.

but how can I sub the $_ from $remainPart anyway?