Dim Dioannou wrote:I want to find a word in a text file and then to take a part of it and to
save it in a String.
for example I have this part of text
and when I find the word ''xmlns:'' I want to take the word after : till =
(rdf in this case) and to put it in a string.
This line copies the matched string (m.group returns the total matched string) from the characters of at position 6 to total length-7, this because
So the total length =7
Hence the code.
Joined: Mar 22, 2005
All the approaches suggested so far are horribly brittle. It's perfectly possible for the XML to change in various valid ways that would break your code. Regexps simply are not capable of dealing with that. If you're handling XML, you need to use XML/DOM APIs.