Search/Replace with Regular Expressions, w/ white space
Posted: Mon Feb 19, 2007 7:57 am
I am formatting large XML documents and I'd like to know more about the use of Regular Expressions in the Search/Replace dialog. There doesn't seem to be any extensive amount of information in the help file. I've been able to use regular expressions pretty successfully as long as I am not searching for multiple lines. I understand the use of the character sets and the variable set () and replacements $1, $2, etc., but I can't seem to get it to find newline characters. I tried searching for things like "\r\n" and {$NEWLINE} but those didn't work.
Some other searches also don't make sense. When I search for $^ (which I thought was end-of-line and then beginning-of-line), it should find every newline, but instead it only finds newlines at the beginning of empty lines.
I'd like two be able to do two different things:
1) Find and replace all white space in between tags "<tag1>stuff</tag1> block of white space maybe with newlines <tag2>stuff</tag2>", including newlines, spaces, tabs, etc.
2) OR Find and DELETE empty lines.
Can anybody show me how to do these things? I'm not really an expert on searching with regular expressions, so if I'm missing something obvious please point it out.
Thanks a lot,
Sarah
Some other searches also don't make sense. When I search for $^ (which I thought was end-of-line and then beginning-of-line), it should find every newline, but instead it only finds newlines at the beginning of empty lines.
I'd like two be able to do two different things:
1) Find and replace all white space in between tags "<tag1>stuff</tag1> block of white space maybe with newlines <tag2>stuff</tag2>", including newlines, spaces, tabs, etc.
2) OR Find and DELETE empty lines.
Can anybody show me how to do these things? I'm not really an expert on searching with regular expressions, so if I'm missing something obvious please point it out.
Thanks a lot,
Sarah