match() madness
in
Programming Questions
•
2 years ago
Ok guys I wondered how to separate content in between html-tags and gave up finding a library. So I had to have a look on RegEx. The Processing-reference suggests me to use match(); to find text-patterns.
I will post my not-working-example in here, but maybe I can find someone who can explain me that:
http://processing.org/reference/match_.html tells me that
String s = "Inside a tag, you will find
content ."; String[] m = match(s, "(\\S+) "); println("Found " + m[1] + " inside the tag."); // Prints "Found content inside the tag." to the console
... should print "Found content inside the tag." to the console. Indeed But if I copy'n'paste that code I get "Found Inside inside the tag."
What's going on there?
My second question:
- println(m);
... results in:
[0] "Inside"
[1] "Inside"
Shouldn't it be:
[0] "Inside"
[1] "content"
?
Thanks a lot for your advice,
André
Edit: I am using Processing 1.5 on a Mac.
1