Discussion:
Search/Replace with line-feed / new-line
Peter Ford
2006-10-06 08:08:40 UTC
Permalink
Hi
I have a niggle with the (5.0) editor:
I'd like the ability to search for new-lines in the replace dialog,
and/or insert new-lines in the replacement text. I find I have to break
out into another editor to do any find and replace like this, and then
reload the changed file in Netbeans - that's a pain...

Cheers
Pete
Jay Logan
2006-10-06 19:54:30 UTC
Permalink
Hello.

What's a niggle?

In the Find/Replace box, select the "Regular Expressions" checkbox.
Then in "Find What", enter \n
In the "Replace With", enter "$0This is$0my replacement$0text that is$0on
four lines"

$0 matches whatever was found in the "Find What" text box. In this case, it
was a newline.
Post by Peter Ford
Hi
I'd like the ability to search for new-lines in the replace dialog,
and/or insert new-lines in the replacement text. I find I have to break
out into another editor to do any find and replace like this, and then
reload the changed file in Netbeans - that's a pain...
Cheers
Pete
--
Jay
Peter Ford
2006-10-09 08:25:13 UTC
Permalink
Post by Jay Logan
Hello.
What's a niggle?
Oh, is that not a global English word: it means a minor annoyance...
Post by Jay Logan
In the Find/Replace box, select the "Regular Expressions" checkbox.
Then in "Find What", enter \n
In the "Replace With", enter "$0This is$0my replacement$0text that
is$0on four lines"
$0 matches whatever was found in the "Find What" text box. In this case,
it was a newline.
Aha, that's part of the answer: searching for new lines is one thing,
but I'd like to be able to search for (say) "foo-bar" and replace with "foo
bar"
I don't get how to put a new line into the replacement without having
one in the search text...
Post by Jay Logan
Hi
I'd like the ability to search for new-lines in the replace dialog,
and/or insert new-lines in the replacement text. I find I have to break
out into another editor to do any find and replace like this, and then
reload the changed file in Netbeans - that's a pain...
Cheers
Pete
--
Jay
Continue reading on narkive:
Loading...