How to find match the regular expression for the data between XML Tag

trying to find match the regular expression for the data between XML Tag (5 digits )

The input is a String

<StudentID>12345</StudentID>

Or it can be

<ID>12345</ID>

The input can be

<Somedata>SSS<Somedata><StudentID>12345</StudentID><Name>MMM</Name>

Or the String can be

<Somedata>SSS<Somedata><ID>12345</ID><Name>MMM</Name>

I have written as (<ID>)\\d{5} and (<StudentID>)\\d{5}

any better way of doing this ?



Read more here: https://stackoverflow.com/questions/66275779/how-to-find-match-the-regular-expression-for-the-data-between-xml-tag

Content Attribution

This content was originally published by Pavan at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: