This is a purely academic regular expression exercise and my understanding of grouping multiple patterns. I have the following example string
<xContext id="ABC"> <xData id="DEF"> <xData id="GHI"> <ID>JKL</ID> <str>MNO</str> <str>PQR</str> <str> <order id="STU"> <str>VWX</str> </order> <order id="YZA"> <str>BCD</str> </order> </str> </xContext>
Using C # Regex I am trying to extract groups of 3 capital letters.
At the moment, if I use the pattern >.+?</ , I get
Found 5 matches: >JKL</ >MNO</ >PQR</ >VWX</ >BCD</
If I then use id=".+?"> , I get
Found 5 matches: id="ABC"> id="DEF"> id="GHI"> id="STU"> id="YZA">
Now I am trying to combine them using the logic OR | for each term on both sides id="|>.+?">|</
However, this does not give me the combined results of both patterns.
My questions:
Can someone explain why this is not working properly?
How can I fix the template so that both shown results are combined in the specified order
How can I further improve the combined pattern to just write letters? I hope this is still ?<= And ?=< , But just want to check.
thanks
source share