Sign in to follow this  
Followers 0
xero

Adding a new line to the StringRegExpReplace function.

4 posts in this topic

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].

Share this post


Link to post
Share on other sites



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 & "<")

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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! :)

Share this post


Link to post
Share on other sites

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0