I have the following data in a variable.
<ctx>
<PostCode>XXXXXX</PostCode>
<Title1>Mr</Title1>
<Name>John</Name>
<Order1>£100.00</Order1>
<Order2>£100.01</Order2>
<Date>10/10/2010</Date
</ctx>
Using the following regex var payload = ctx.toString().match(/Order[1-9]/g);
I get the following results
Order1,Order1,Order2,Order2
How can I make it stop at Order1, Order2 as is counting the second closing tag, also I can't use <Order[1-9]>
(opening tag) as my application does not allow me to capture the tags <>
. Basically a regex that returns unique values.
So the following regex seems to work to some extend. (Order[0-9])(?!.*\1)