I want to resolve: <tag>alphabetic characters and space</tag>
I propose this one:
<.*>([A-Za-z]+)</.*>
is this correct?
I want to resolve: <tag>alphabetic characters and space</tag>
I propose this one:
<.*>([A-Za-z]+)</.*>
is this correct?
Please, for the sake of whatever poor developer will have to deal with your code after you, please do not try to parse XML with regular expressions.
Use a SAX or DOM parser instead. There are plenty of good guides on the web if you search on Google, but here is a quick example using the standard javax.xml package...
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(xmlFile);
Node node = doc.getElementsByTagName("tag").item(0);
String value = node.getNodeValue();
What if the input is: <tag> something <inner-tag> some other thing </inner-tag> </tag> ?
I'd suggest you to use an XML parser library, e.g. Apache Digester.