From: SourceForge.net <no...@so...> - 2012-01-19 20:15:50
|
Bugs item #1325082, was opened at 2005-10-12 10:50 Message generated for change (Comment added) made by sjakob You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100588&aid=1325082&group_id=588 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: search and replace Group: severe bug Status: Open Resolution: None Priority: 7 Private: No Submitted By: Alan G (abgrover) Assigned to: Nobody/Anonymous (nobody) Summary: matching word break also matches interior of word Initial Comment: In 4.2 final Searching with the regular expressions \b. or \<. jumps to the beginning of a word, unless the cursor is already in a word, in which case it finds the next character within the word. This makes it impossible to replace characters only at the beginning of a word. For instance: search on \<. replace with BeanShell snippet _0.toLowerCase() should force the first character of every word to be lower case. However, it actually forces *every* character of every word to be lower case. ---------------------------------------------------------------------- >Comment By: Steve Jakob (sjakob) Date: 2012-01-19 12:15 Message: I don't think this is a bug. I see 2 issues with Alan G's approach: 1) Note that the boundary matching characters match the boundary and not the characters themselves. Each word has two boundaries, one BEFORE the first character and one AFTER the last. Your regex will match the first boundary of your complete search string, which occurs before the first word character. 2) The replace string you specify indicates that you want to replace every character with a lower-case character since "_0" refers to the complete contents of your searched text. To clarify, if my search text is the string "this text" Alan's BeanShell snippet is equivalent to "this text".toLowerCase(). As an alternative, the following appears to work for me: Search regex: \b(\w)(\w*) Replace with BeanShell snippet: _1.toLowerCase() + _2 By separating the first character of each word (following a boundary) from the rest I can transform just that one character. ---------------------------------------------------------------------- Comment By: Robert Schwenn (rschwenn) Date: 2008-03-02 13:44 Message: Logged In: YES user_id=1486645 Originator: NO The gnu.regex-Package is thrown away now. Not so the bug. For example: - The Expression "\b." matches *every* single charcter in a word. - The Expression ".\b" matches the last charcter in a word (as expected) but also a following space character. jEdit 4.3pre12 JRE 1.6.0_03 WinXP SP2 ---------------------------------------------------------------------- Comment By: Björn Kautler (vampire0) Date: 2005-10-12 20:39 Message: Logged In: YES user_id=918212 As far as I have found, \b, \< and some others are not supported by the gnu.regex-Package. One additional point for throwing it away and using java.util.regex instead. ;-) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100588&aid=1325082&group_id=588 |