I have some text that's split out onto multiple lines that I would like to be on one line in my dofile. Obviously I can edit this by hand, but it would be easier if I could search and replace.
I noticed that the dofile editor in Stata 13 has the option to use regular expressions during replace. However, I'm not having any luck matching the line breaks.
I can use a regular expression to insert a line break but not remove one.
For example say I start with:
this is some text that could be ~ multiple lines using the tilde as a breakpoint
If I do the following:
find what: ~
replace with: \n
I get:
this is some text that could be
multiple lines using the tilde as a breakpoint
However, this isn't reversible. Nothing happens if I do the following on the text after making it two lines:
find what: \n
replace with: ~
I've tried \n \r and \r\n. None of these seem to match to the stata line break when used in the find box, though they all work in the replace with box. Regular expressions are not my strong suit. Am I missing something obvious here?
I'm not looking for advice on what other editors might allow me to do this. I'm currently on a borrowed computer that I can't install software on. So I'm trying to figure out if this can be done with the tools I have at hand.
I noticed that the dofile editor in Stata 13 has the option to use regular expressions during replace. However, I'm not having any luck matching the line breaks.
I can use a regular expression to insert a line break but not remove one.
For example say I start with:
this is some text that could be ~ multiple lines using the tilde as a breakpoint
If I do the following:
find what: ~
replace with: \n
I get:
this is some text that could be
multiple lines using the tilde as a breakpoint
However, this isn't reversible. Nothing happens if I do the following on the text after making it two lines:
find what: \n
replace with: ~
I've tried \n \r and \r\n. None of these seem to match to the stata line break when used in the find box, though they all work in the replace with box. Regular expressions are not my strong suit. Am I missing something obvious here?
I'm not looking for advice on what other editors might allow me to do this. I'm currently on a borrowed computer that I can't install software on. So I'm trying to figure out if this can be done with the tools I have at hand.
Comment