Recently I just realize that in if you want to match "any character" in Java/Groovy, you should not use dot match (.).
The reason is: dot match only works for single line text, will not work for line breaks. For the multiple lines text matching, the solution to match any character is using [\s\S].
Please refer this article for details.
For example, following code snippet is used for stripping the javascript code in the text
Source code:
Thanks for sharing this basic concept on Java, curently i am learning both core and Advanced Java.
ReplyDelete