php - Regular expression to search in html template -
i'm trying find strings in lot of files (cc. 2000 files).
what need find id attribute in html file except id's.
for example want find:
<a id="certain_id">sdfsdf</a>
but want exclude:
<a id="manage">manage</a>
i need regular expression since want use in eclipse search. if cannot can make php file too.
something like: id="(?!manage)" or similar. don't want replace want list of elements in each file.
thanks help
this worked me:
id="(?!(manage|something)").*?" ^ ^ ^ | | character (not greedy), followed quote | negative lookahead make sure there isn't manage|something , quote match id=" characters literally
where manage
, something
2 ids don't want match.
you use make non-greedy:
id="(?!(manage|something)")[^"]+"
Comments
Post a Comment