0

I'm using Intellij and I want to search for XML attributes.

For example this XML line:

<img src="madonna.jpg" alt='Foligno Madonna, by Raphael' />

I want to search my project for any other instances of this line:

<img src="BLABLALBA" alt='BLABLALBA' />

I tried using this regular expression : src="\W" but no results was found.

Any help appriciated.

Bas Leijdekkers
  • 23,709
  • 4
  • 70
  • 68
Eden G
  • 60
  • 8
  • 2
    Welcome to SO! In short: better use a parser instead. Similar question answered yesterday: http://stackoverflow.com/questions/34252497/php-regexp-parse-html/34253108#34253108 – Jan Dec 14 '15 at 07:19
  • [Parsing XML with regex is generally considered a bad idea](http://stackoverflow.com/a/1732454/3991344). – Pokechu22 Dec 15 '15 at 02:17

1 Answers1

1

Try Structural Search & Replace (Edit | Find | Search Structurally...). Use the following pattern:

<img src="$A$" alt="$B$" />

And set the file type to XML or HTML depending on what type of files you are searching.

Bas Leijdekkers
  • 23,709
  • 4
  • 70
  • 68