xero Posted January 15, 2007 Posted January 15, 2007 Hello! I have a very quick query.. I have a little trouble with using the StringRegExpReplace function. I am trying to edit some text in a .txt file, and what I want it to do is basically split one line of text into 2 lines at certain points. For example, if I have this: <hello>blah</hello><hello>blah</hello> I want to turn it into this: <hello>blah</hello> <hello>blah</hello> Now, I am getting quite far with working out how to do it (have a few different ideas...) but the problem is, how to either 1/ send the {ENTER} command, or somehow make the script start a new line at the given place. Hope this makes sense, and sorry if it doesn't! Many thanks, [xero].
seandisanti Posted January 15, 2007 Posted January 15, 2007 Hello! I have a very quick query.. I have a little trouble with using the StringRegExpReplace function. I am trying to edit some text in a .txt file, and what I want it to do is basically split one line of text into 2 lines at certain points. For example, if I have this: <hello>blah</hello><hello>blah</hello> I want to turn it into this: <hello>blah</hello> <hello>blah</hello> Now, I am getting quite far with working out how to do it (have a few different ideas...) but the problem is, how to either 1/ send the {ENTER} command, or somehow make the script start a new line at the given place. Hope this makes sense, and sorry if it doesn't! Many thanks, [xero].i wouldn't even go with regex on this one, just StringReplace. $mashed = "<hello>blah</hello><hello>blah</hello>" $split = StringReplace($mashed,"><",">" & @cr & "<")
xero Posted January 15, 2007 Author Posted January 15, 2007 i wouldn't even go with regex on this one, just StringReplace. $mashed = "<hello>blah</hello><hello>blah</hello>" $split = StringReplace($mashed,"><",">" & @cr & "<") You're a saviour, thankyou.. If I can figure this out now (if my brain holds up until I get home..!) this will save me many hours of painful typing.. Thanks!
seandisanti Posted January 15, 2007 Posted January 15, 2007 You're a saviour, thankyou.. If I can figure this out now (if my brain holds up until I get home..!) this will save me many hours of painful typing.. Thanks! np, happy to help
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now