I designed a regex to identify the xml block inside a text file. The expression is as follows (I removed all the slashes to remove java so that they are easy to read):
<\?xml\s+version="[\d\.]+"\s*\?>\s*<\s*rdf:RDF[^>]*>[\s\S]*?<\s*\/\s*rdf:RDF\s*>
Then I optimized it and replaced [\s\S]*? on .*? . He suddenly stopped recognizing xml.
As far as I know, \s means that all space characters and \s mean all characters with non-white space or [^\s] , so [\s\S] should logically be equivalent . I have not used greedy filters, so what could be the difference?
source share