Someone recently asked me a regular expression query and I thought it was interesting and post it as an example here.  They wanted to find all occurances of the following style of XML:

<foobar>

      < property = "blah" />

</foobar>

And they wanted to replace all of the above into one string

<foobar property = "blah"/>

And here is the nifty regular find what and replace with expression that does it all for you!  I highlighted the tagged expressions in pink.

Find what:  \<{:w}\>:Wh*\<{:Wh*:a+:Wh*=:Wh*":a+":Wh*}/\>:Wh*\</\1\>

Notice that the characters < > all needed to be escaped via the escape character "\" since we want the actual characters themselves

Also, recall that :w is any alphabetic string, :Wh is any white space, and :a is any alphanumeric string

Based on my previous tutorials, I'll leave it to you to thoroughly decipher this regex query :)

As for the replace:

Replace with: <\1\2/>

Your replace string become <TaggedExpression1TaggedExpression2/>

Regards,

Fiona