Re: replace with Unicode code point
maxwell <[email protected]>
| Newsgroups | gmane.editors.jedit.user |
|---|---|
| Message-ID | <[email protected]> |
Eric--
Thanks for your suggestion; unfortunately, while it works for the
original case I gave, it doesn't work in some other situations.
Specifically, it doesn't work if I want to insert a specific Unicode
code point AND some variable from the input line. In my particular
case, the input is
\u012B([\u0300-\u03FF])
(pre-composed small 'i' with macron + any combining diacritic)
and the output is
"\u0131\u0304$1"
(small dotless 'i' plus combining macron + the original combining
diacritic)
The first two Unicode code points--\u0131\u0304--come out correctly as
the two Unicode chars at those code points (which is what I couldn't get
before your suggestion). Unfortunately, the '$1' comes out as the
string '$1', i.e. it is not a copy of the original combining diacritic.
I suspect there's a way to do this with a "BeanShell snippet", but I
don't know beans about this...
So I think I'm going to submit a bug report on this. Specifically, the
report will suggest that the use of Unicode code points in the "Replace
with" box should function as I would expect, i.e. to introduce the
character at the specified code point; and they should do so in either
the \x{0131} syntax or the \u0131 syntax, the same way they do in the
"Search for" box.
Somebody stop me if there's a good reason I shouldn't do this!
Mike Maxwell
On 2017-11-05 11:07, Eric Le Lay wrote:
> Choosing to replace with a **beanshell snippet** rather than **text**
> and surrounding the replacement with double quotes ("\u016B") works.
in response to my Fri, 03 Nov 2017 18:09:31 -0400:
>> I'm trying to use regex's that include Unicode code points in both
>> the search and the replace parts. It works fine for search, but not
>> for replace.
>>
>> Specifically, I can enter the sequence
>> \x{016B}\x{0304}
>> in the "Search for" box in the "Search and Replace" dialog box, or
>> equivalently
>> \u016B\u0304
>> and it finds the characters (ū̄) correctly. (FWIW, this is a
>> pre-composed u+macron followed by a combining macron, which is of
>> course redundant...which is why I'm trying to replace it.)
>>
>> If I then enter the string
>> \x{016B}
>> or equivalently
>> \u016B
>> in the "Replace with" box in that same "Search and Replace" dialog
>> box, I would expect the search string in the buffer to be replaced by
>> ū
>> But instead it gets replaced by
>> u016B
>> I would consider this a bug. If Unicode code points work in the
>> Search box, they should also work in the Replace box.
>>
>> Before I submit a bug report, though, I want to find out whether I'm
>> doing s.t. wrong. I do of course have the "Regular expressions" box
>> checked in the dialog box (else the search wouldn't work). Does
>> anyone have any suggestions? Or a reason why this is a feature
>> rather than a bug.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--
-----------------------------------------------
jEdit Users' List
[email protected]
https://lists.sourceforge.net/lists/listinfo/jedit-users