A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Head First Android
this week in the
Programmer Certification (SCJP/OCPJP)
Doubt on Regular Expression
Joined: Jan 28, 2005
May 14, 2007 01:18:00
String s = AnyCharacter|AnyCharacter; String replaceString = "test|"; //expected is test|AnyCharacter //but the result is test|AnyCharacter|AnyCharacter s = s.replaceFirst("\\.\\*|", replaceString);
I've tried to use Greedy/Reluctant/Possessive quntifiers, but can't get the result I expected. Can someone help me out?
To be or not to be. It's a question.
Joined: Aug 03, 2002
May 14, 2007 01:50:00
Use ".*\\|" as the regular expression.
Ask a Meaningful Question
Getting someone to think and try something out is much more useful than just telling them the answer.
I agree. Here's the link:
subject: Doubt on Regular Expression
can we change sendRedirect() method?
display unicode characters in midlet
print to a file interrupted with runtime error
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015