help with regular expressions
Posted on 2006-07-20
I require some help with the regular exp in java.
I have a String say
String test="regular +expr + java+ example";
I will get the String as req parameter.
If I find space before and after " + " I will have to remove that and replace that to test="regular +expr+java+example";(without any spaces)
if there is space after "+ " then the String should become test="regular +expr+java+example";(without any spaces)
If I have space only before " +"it should stay as it is test="regular +expr+java+example";
The only condition when the "+" will remain unaltered is when it is preceded by space(s) and immediately followed by text with no space in between.i.e(regular +expr).
Please help me.