setaret2004 wrote:You don't need the question marks. A question mark means: "zero or one time" and a STAR means "zero or more times". So by writing:
I want to match "this is a test" regardless of how many spaces (or tabs and newlines) it has between all the words. I am not sure if I am doing it right though..This is what I haveThanks!
this (\s*)?is (\s*)?a (\s*)?test
you're saying: "match any number of white space characters, zero or one time". Needless to say: that doesn't make a lot of sense (although it is allowed, of course).
Encephalopathic wrote:And the worst part of it, folks, is that he's forcing me to do disgusting and unnatural acts, like JavaFX.BigDaddyLoveHandles wrote:And I'm going to be a Duke Pïmp. You owe me half of your take, Beyatch.
Feel free to hand out them dukes, setaret2004. My New Year's resolution is to become a Duke Whöre.
it works but i dont understand why i needed 4 and not 3 backslashes. Thanks!
for(String keyword : keywords) keyword=keyword.replaceAll(" ", "(\\\\s*)");