I'm not quite sure I understand the problem completely but I think that the problem is that * is greedy. Try using +? instead (take a look at the package javadoc for org.apache.oro.text.regex to find out more about greediness). So in the end your regex might look something like (\?_)|(v_)(.+?)_ This will match xxx in group 3 and pick out both the ?_xxxx_ and v_xxxx_ matches.
hth Dave > -----Original Message----- > From: Phillip Rhodes [mailto:[EMAIL PROTECTED]] > Sent: 15 August 2002 04:55 > To: [EMAIL PROTECTED] > Subject: can't find v_xxxx_ in sentence > > > Hi. > > Given the following sentence: > You are v_xx_ nice to help me with my problem. It is very ?_xxxxxx_ > > I would like to find the v_xx_ strings and the ?_xxxxx_strings. > The target matches begin with a ?_ or v_ and end with a _ > The "xxx" stuff is what could be dynamic. > > I am using a regex of v_.*?_ to get the matches, but my > results are not > right. I get a hodpodge of results, some right, some wrong. > For example, I will get a _you are_ not going to find this match_ > It seems to pass the first _ in the string being evaluated. > > > Thanks. I appreciate the help very much. Especially since > it's midnight now. > > > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>