Tuesday, August 10, 2010

how to use regular expression to replace tag info but preserve XML value in UltraEditor

I recently exported the data from Oracle DB thru Oracle SQL Developer for testing, the extracted data is as follow

<>
<>
< name="ROWNUM">999< /COLUMN>
< name="CONTENT_UUID">0< /COLUMN>
....
< /ROW>
<>
< name="ROWNUM">1000< /COLUMN>
< name="CONTENT_UUID">0< /COLUMN>
...
< /ROW>
...
< /RESULTS>

How do I change it to using Ultra Editor
<>
<>
<>999< /ROWNUM>
<>0< /CONTENT_UUID>
...
< /ROW>
<>
<>1000< /ROWNUM>
<>0< /CONTENT_UUID>
...
< /ROW>
...
< /RESULTS>

  1. Go to Tool bar, Search -> Replace
  2. Check the "Regular Expressions", and select "UltraEdit" from Regular Expression Engine below
  3. At the Find What section, enter "< name="ROWNUM">^(*^)< /COLUMN>" , where ^(*^) is the wildcard
  4. At the Replace With section, enter "<>^1< /ROWNUM>", where ^1 is the first value, you can have more than one wildcard value, you can use "^1", "^2"... for replacing any wildcard according to find what sequence

reference:
http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/regular_expressions.html#tagreformat

http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/tagged_expressions.html

No comments:

Post a Comment