 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
UIO1 Guest
|
Posted: Thu Jul 24, 2008 1:33 am Post subject: semi-complex data parse question, please help |
|
|
Hi, I want to parse thru some extensive SGML code and remove certain tags.
Could someone demonstrate the most efficient way to do this?
read from data.txt
<xyz remove1="goaway" remove2="goaway" keep1="hellowrodl" keep2="youareperfect"></xyz>
... so like, if someone can show me how on one pass it can find, and remove remove1="goaway", then i think i can figure out how to expand it
would result in,
<xyz remove2="goaway" keep1="hellowrodl" keep2="youareperfect"></xyz> |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 912 Location: The Interwebs
|
Posted: Thu Jul 24, 2008 1:48 am Post subject: |
|
|
| Code: | FileRead, Data, data.txt
Data := RegExReplace(Data,"remove1="".+""")
MsgBox, % Data |
|
|
| Back to top |
|
 |
UIO1 Guest
|
Posted: Thu Jul 24, 2008 5:16 am Post subject: |
|
|
| Kewel, thank you!! |
|
| Back to top |
|
 |
UIO1 Guest
|
Posted: Fri Jul 25, 2008 8:46 pm Post subject: |
|
|
Hi there Krogdor,
Thank you for this script... but it actually seems to work too well
It does remove the instance specified, but it also unfortunately removed the rest of the tags too!!
I.E.
before
<xyz remove1="goaway" remove2="goaway" keep1="hellowrodl" keep2="youareperfect"></xyz>
after
<xyz></xyz>
==============
Instead of:
before
<xyz remove1="goaway" remove2="goaway" keep1="hellowrodl" keep2="youareperfect"></xyz>
after
<xyz remove2="goaway" keep1="hellowrodl" keep2="youareperfect"></xyz> |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|