1

How can I remove the duplicates from between class="" in the following string?

<li class="active active"><a href="http://netcoding.net/indev/sample-page/">Sample Page</a></li>

Please note that the classes shown can change and be in different positions.

Brian Graham
  • 12,107
  • 12
  • 55
  • 95
  • 1
    The real problem to solve is why you have duplicates in the first place! – Sparky Apr 02 '14 at 16:31
  • 1
    So this is *almost certainly* not going to be possible with Regex. You are really going to have to *parse* this string. – Mike Perrenoud Apr 02 '14 at 16:31
  • 1
    The OP is a classic example of the "XY Problem": http://meta.stackexchange.com/a/66378/157574 – Sparky Apr 02 '14 at 16:36
  • You're not looking to "remove duplicate words from between quotes". You want to "remove duplicate words from the class attribute of an HTML
  • tag". You'll want to use a DOM parser.
  • – Andy Lester Apr 02 '14 at 16:37
  • 1
    What @Sparky said. Please don't try and solve a symptom, solve the underlying problem instead. – ScottMcGready Apr 08 '14 at 14:49