Q:

Regular expression to delete everything in a file except a string

I'm trying to parse some svg coordinates with Notepad++. I would like take the coordinate set of each layer and put the coordinates inside [] to make it ready to be used in a javascript array. 
The svg file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build     43363)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"  xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="800px"
 height="900px" viewBox="0 0 800 900" enable-background="new 0 0 800 900"   xml:space="preserve">
<g id="Layer_3">
<polyline fill="none" stroke="#0000FF" stroke-width="3" points="33,108 66,141 99,174 99,207 132,207 165,207 165,240     "/>
</g>
<g id="Layer_4">
<polyline fill="none" stroke="#0000FF" stroke-width="3" points="132,306 165,306 165,339 165,372 132,405 99,405 99,438 132,438 
    165,438     "/>
</g>
<g id="Layer_5">
<polyline fill="none" stroke="#0000FF" stroke-width="3" points="198,339 231,339 264,372 297,372 330,405 363,438 396,438     "/>
</g>
<g id="Layer_6">
<polyline fill="none" stroke="#0000FF" stroke-width="3" points="198,174 198,273 231,306 264,306     "/>
</g>
<g id="Layer_7">
<polyline fill="none" stroke="#0000FF" stroke-width="3" points="231,174 231,240 264,273 297,273     "/>
</g>
<g id="Layer_9">
<polyline fill="none" stroke="#0000FF" stroke-width="3" points="396,306 462,306 495,339 495,372 528,405 528,438 561,438 
    594,471     "/>
</g>
<g id="Layer_10">
<polyline fill="none" stroke="#0000FF" stroke-width="3" points="660,504 561,504 495,504     "/>
</g>
</svg>

I would like the result to look something like this:
[33,108 66,141 99,174 99,207 132,207 165,207 165,240]

[132,306 165,306 165,339 165,372 132,405 99,405 99,438 132,438 165,438]

[198,339 231,339 264,372 297,372 330,405 363,438 396,438]

[198,174 198,273 231,306 264,306]

[231,174 231,240 264,273 297,273]

[396,306 462,306 495,339 495,372 528,405 528,438 561,438 594,471]

[660,504 561,504 495,504]

I'm quite new to regular expressions, but here's my feeble attempt:
search for: .+points="(.+")
replace with: [$1]
I'm stuck because the search part doesn't seem to search lines above the "points" string. How can I get rid of everything but the coordinates, even if there is garbage much higher in the document?

A:

First of all I have to agree in general with Ken White about not parsing XML with regexes. But if you want a quick and dirty solution in Notepad++ try this one (don't forget to check the option ". matches newline"):
Find:
.+?points="(.+?)\s*"

Replace:
[$1]\n\n

This will almost give you the anticipated result (you will still have to manually remove some trailing characters).

