Quantcast
Channel: UltraEdit, UltraCompare, UEStudio forums
Viewing all articles
Browse latest Browse all 307

Scripts • Find/Replace line breaks within XML elements with simple RegEx

$
0
0
I would like to revoke line breakes within the text element of an XML file with a simple script to accelerate such work.
But it deletes as well the entire entry. How can I preserve the text here. 

Code:

if (UltraEdit.document.length > 0)  // Is any file opened?{   // Define the parameters for a case-sensitive Perl regular expression   // replace all and run the replace on entire file.   UltraEdit.perlReOn(true);   UltraEdit.activeDocument.findReplace.regExp=true;     UltraEdit.activeDocument.findReplace.replace("<DESCRIPTION_SHORT>([^<]*)\n([^<]*)</DESCRIPTION_SHORT>","<DESCRIPTION_SHORT>\1 \2</DESCRIPTION_SHORT>");   UltraEdit.activeDocument.findReplace.replace("<MANUFACTURER_TYPE_DESCR>([^<]*)\n([^<]*)</MANUFACTURER_TYPE_DESCR>","<MANUFACTURER_TYPE_DESCR >\1 \2</MANUFACTURER_TYPE_DESCR>");}

statistics: Posted by Estanislao16:33 - 1 day ago — Replies 1 — Views 137



Viewing all articles
Browse latest Browse all 307

Latest Images

Trending Articles