The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!
i've just played around with find/replace a bit and it seems replace only supports reading matching groups from the 'find' expression(see content assist with $i). If you uncheck 'regular expression' in find the regex option is disabled in replace.
Interesting sidenote:
following Riyads advice i tried adding more backslashes:
\t -> t (no surprise here)
\\t -> \t (not tabulator but text)
\\\t -> \t (same.. wheres that extra backslash?)
\\\\t -> \\t (duh, i got bored then)
eclipse version used:
Version: 3.1.0
Build id: I20050627-1435
i was really surprised by this, i am used to do find/replace stuff with textpad on windows, but this is a common task and eclipse should be able to do it.
I found a little work-around. To get a new-line character, type the following in Eclipse:
--snip--
c
c
--snip--
(if the above doesn't format correctly for some reason, it is just a character on one line, and a character on the line below it)
Copy the two characters into the "Replace with" box and you'll now see something like:
c{weird character}c
Now, just replace the two c's with your own regexp stuff. The weird character will work as a newline.
(PS my editor's encoding is set to UTF-8 - don't know if this is important to know for this workaround.)
Yes Dominik, i too found the same effect. Looks like the replace does not really support the control chars. In fact there are many chars supported in the find but not in replace. Its ironic somehow.
newlines in regex find & replace
At 9:02 PM on Feb 19, 2006, Rob Agar
wrote:
I assumed it would be the normal regex \n, but the backslash just gets stripped leaving a literal "n".
5 replies so far (
Post your own)
Re: newlines in regex find & replace
You need to escape your escape char, confusing right? Try \\n, if that doesn't work, keep adding slashes until it does (I'm not kidding, weird hu?)There is some information about this in the Javadoc for the Pattern/Matcher classes in the JDK, about escaping escape sequences.
Re: newlines in regex find & replace
i've just played around with find/replace a bit and it seems replace only supports reading matching groups from the 'find' expression(see content assist with $i). If you uncheck 'regular expression' in find the regex option is disabled in replace.Interesting sidenote:
following Riyads advice i tried adding more backslashes:
\t -> t (no surprise here)
\\t -> \t (not tabulator but text)
\\\t -> \t (same.. wheres that extra backslash?)
\\\\t -> \\t (duh, i got bored then)
eclipse version used:
Version: 3.1.0
Build id: I20050627-1435
i was really surprised by this, i am used to do find/replace stuff with textpad on windows, but this is a common task and eclipse should be able to do it.
also see bug52338
Re: newlines in regex find & replace
> also see bug52338the most recent comment on the bug says this:
find: \n
replacewith: "+\n"
This will just delete all lines in the code.
Rather an alarming bug for something as apparently straightforward as search+replace! Definitely worth a bugzilla vote.
Re: newlines in regex find & replace
I found a little work-around. To get a new-line character, type the following in Eclipse:--snip--
c
c
--snip--
(if the above doesn't format correctly for some reason, it is just a character on one line, and a character on the line below it)
Copy the two characters into the "Replace with" box and you'll now see something like:
c{weird character}c
Now, just replace the two c's with your own regexp stuff. The weird character will work as a newline.
(PS my editor's encoding is set to UTF-8 - don't know if this is important to know for this workaround.)
Re: newlines in regex find & replace
Yes Dominik, i too found the same effect. Looks like the replace does not really support the control chars. In fact there are many chars supported in the find but not in replace. Its ironic somehow.