3

I have the following lines in my code at many places. I want to find all of them at once and replace each of such block with new comment. However i am able search single line at a time. But i am not getting how to include new line in my regular expression to search please help.

// Block Solver
// We develop a block solver that includes the joint limit.
// when the mass has poor distribution (leading to large torques about..
//

Thanks in advance

2
  • Are you asking about how to find commented lines using your editor? Which one? Commented Jan 25, 2013 at 13:28
  • Thank you for responding. Question is about finding in the editor itself, using Xcode,s find and replace. Commented Jan 28, 2013 at 5:00

1 Answer 1

5

Search for:

^(?://.*\n?)+

and replace all with nothing.

This will find all lines that start with //.

Sign up to request clarification or add additional context in comments.

7 Comments

yes, you are right Tim. Could you suggest me what should i do if i want to find each such block as shown in my question which contains three commented lines, at once. Thank you.
It should be matching the entire block at once. Isn't it doing that?
It is currently matching each line separately. In my case i should search all three lines as in my question at a time, for uniqueness. It aslo helps in replacing such blocks. Each result should be a block containing three commented lines.
Try ^(?://.*\n){3} - does this work? I don't own a Mac, so I can't test this myself.
Tried it. Not working. I also tried by removing '^' and again by pasting the expression three times but no luck. I dont know why but, whenever i try to match something which presides a newline character, it wont work and my be number of occurrence '{}' is also not working.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.