-6

I want to extract a substring from "<" to "xmlns" in

<?xml version="1.0" encoding="ISO-8859-1"?>
<XXXXX xmlns

then result is "XXXXX", only need 1 time. How can I do this?

Pham Huu Bang
  • 105
  • 2
  • 10
  • 1
    do you really want to do it with regex? there are more suitable ways if you are working on an xml. – SomeJavaGuy Jan 06 '16 at 08:56
  • 1
    Can you search before ask? Perhaps how to make substring from string in java? Usually very general questions are already answered. – Milkmaid Jan 06 '16 at 08:57
  • ok, I know this is wrong idea. – Pham Huu Bang Jan 06 '16 at 08:58
  • Regex: `<([A-Za-z:_][A-Za-z0-9:_.-]*) xmlns`, assuming tag name only uses ASCII characters, otherwise extend as defined in the [XML spec](http://www.w3.org/TR/REC-xml/#NT-Name). – Andreas Jan 06 '16 at 09:02

1 Answers1

-1
<[^>]+xmlns

Does the above regex help you? Check this answer as well https://stackoverflow.com/a/406408/5119047

Community
  • 1
  • 1
Vaspar
  • 566
  • 3
  • 9