Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i don't how replace this text into this:

ab fg\r fsd&

into this:

a
b

f
g
\r

f
s
d
&

And Viceversa:

r
f

f
f

into this:

rf ff

Can u help me, please?

share|improve this question
    
Is it intentional that there's no newline between \ and r? What exactly is the rule? Are there spaces on the "empty" lines? –  Dennis Jul 23 '12 at 19:17
    
yes..the empty lines ARE spaces, not empty lines. The \r is right, there isn't newline –  user143822 Jul 23 '12 at 19:22
add comment

1 Answer

To go from one line to many:

  • Find: (.) - Find any single character and capture it for reference in the replace
  • Replace: \1\r\n - put the first capture then add a carrage return and a new line.

Assuming there is a space on the empty line you can go back by switching from Regex to Extended and using:

  • Find: \r\n - find the end of a line
  • Replace - leave it blank.
share|improve this answer
    
\r\n --> leave blank it gives me all the letters without regard to neighboring spaces. –  user143822 Jul 23 '12 at 19:24
    
@user143822 As Scott already said, it works if all "empty" lines contain a space (they will if you previously used the described first regex replacement for splitting). However, if empty lines are indeed empty then there is no space to respect when replacing all occurrences of \r\n with an empty string. –  speakr Aug 4 '12 at 12:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.