0

I need to search multiple xhtml documents looking for the following: any tag where there's the string action= but not the string update= I'm using the Eclipse Search, so i need the regex in Java format

If i'm not wrong this can be achieved with the following (i also ignore spaces between action/update and = )

^(?!.*update\s*=).*action\s*=.*$

My problem is a single line search like this would not be enough, since html tags could span across multiple lines.

So, i would need to look between the < and the > of the tag, even if on different line.

Can that be achieved?

Example lines i want to match (i don't care if the part gets ignored:

<a href="#" action="test" update="test_container"></a>

<a href="#" action="test2"
 update="test_container2"></a>

<mytag href="#" update="test_container3"
action="test3" />
dgtal
  • 193
  • 16
  • 2
    [Regex is **NOT** a good tool to parse HTML/XML](https://stackoverflow.com/a/1732454/5784924). – Nicolas Apr 20 '20 at 13:34

1 Answers1

0

action=, but not update= inside <...>:

<([^>](?!update\s*=))*action\s*=([^>](?!update\s*=))*>
howlger
  • 31,050
  • 11
  • 59
  • 99