-1

Updated I'm trying to match all the ['ta] character(s) between two non capture groups like this (static xml):

Example xml

<Monkey xmlns="http://urlhere.com/monkeynamespace">
 <foodType>
  <vegtables>
   <carrots>i don't like carrots, or tomatoes</carrots>
  </vegtables>
 <foodType>   
</Monkey>

And my regex

/(?:(<.*?>))(['ta])(?:(<\/.*?>))/gm

Any ideas? Seems like that regex turns lazy.

Baked Inhalf
  • 3,375
  • 1
  • 31
  • 45

1 Answers1

1

Try this:

['ta](?=[^<>]*<)

See live demo.

It's not bulletproof, but works for your sample and will work for typical xml.

It works by matching ['ta] only when the next angle bracket in the input is a left angle braket.

Bohemian
  • 412,405
  • 93
  • 575
  • 722