AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

semi-complex data parse question, please help

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
UIO1
Guest





PostPosted: Thu Jul 24, 2008 1:33 am    Post subject: semi-complex data parse question, please help Reply with quote

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 Smile

would result in,

<xyz remove2="goaway" keep1="hellowrodl" keep2="youareperfect"></xyz>
Back to top
Krogdor



Joined: 18 Apr 2008
Posts: 912
Location: The Interwebs

PostPosted: Thu Jul 24, 2008 1:48 am    Post subject: Reply with quote

Code:
FileRead, Data, data.txt
Data := RegExReplace(Data,"remove1="".+""")
MsgBox, % Data
Back to top
View user's profile Send private message AIM Address
UIO1
Guest





PostPosted: Thu Jul 24, 2008 5:16 am    Post subject: Reply with quote

Kewel, thank you!!
Back to top
UIO1
Guest





PostPosted: Fri Jul 25, 2008 8:46 pm    Post subject: Reply with quote

Hi there Krogdor,

Thank you for this script... but it actually seems to work too well Cool

It does remove the instance specified, but it also unfortunately removed the rest of the tags too!!Smile

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
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group