I want to create a regular expression that matches with the string
"B. Hello" or "C. Hello" and so on..
I tried number of things and finally came up with this
String REGEX = "[A-Za-z]"+Pattern.quote(".")+" Hello";
but still no luck.. I tries using '\s' for space but still not working. Can anybody help me out with this. Ultimately , i need to do something like this
if("B. Hello".equals(REGEX))
System.out.println("Hello ,B ");
Thank you
see here: http://www.vogella.de/articles/JavaRegularExpressions/article.html and here: http://mindprod.com/jgloss/regex.html
but why not use a simple if statement to separate the input into what you want?
DavidKroukamp
Practically a Master Poster
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169