How do I specify a Unicode string to RegExReplace?

Get help with using AutoHotkey and its commands and hotkeys
destatez
Posts: 3
Joined: 24 Nov 2016, 16:50
GitHub: destatez

How do I specify a Unicode string to RegExReplace?

24 Nov 2016, 19:55

I would like to use RegExReplace to remove some specific Unicode characters from the clipboard buffer. What I need to know is how to specify the search string with Unicode. I was using perl for this, with a string: "\N{U+05B0}|\N{U+05B1}|\N{U+05B2}|\N{U+05B3}|\N{U+05B4}|\N{U+05B5}|\N{U+05B6}|\N{U+05B7}|\N{U+05B8}|\N{U+05B9}|\N{U+05BA}|\N{U+05BB}|\N{U+05BC}|\N{U+05BD}|\N{U+05BE}|\N{U+05BF}|\N{U+05C0}|\N{U+05C1}|\N{U+05C2}|\N{U+05C3}|\N{U+05C4}|\N{U+05C5}|\N{U+05C6}|\N{U+05C7}|\N{U+05C8}|\N{U+05C9}|\N{U+05CA}|\N{U+05CB}|\N{U+05CC}|\N{U+05CD}|\N{U+05CE}|\N{U+05CF}". How can I specify this in AutoHotKey format for the RegExReplace function?

My routine looks like:
UCodeRepl() {
static tRepl1 := <Unicode string>
Clipboard := RegExReplace(Clipboard,tRepl1,"")
}
destatez
Posts: 3
Joined: 24 Nov 2016, 16:50
GitHub: destatez

Re: How do I specify a Unicode string to RegExReplace?

25 Nov 2016, 08:29

Thanks. That is too easy, but great. I changed the ahk file to the following, where I simply select what I want processed and then invoke the ahk file. This is great since perl has an oversight of not allowing UTF-8 to be written back into the clipboard buffer, you can only read that into the buffer. This is a routine to remove any/all Hebrew pointing from the selected text.
!.::
send ^c
NoHebrewPoints()
send ^v
return
NoHebrewPoints() {
static tRepl1 := "[\x{05B0}-\x{05CF}]"
static tRepl2 := "[\x{0590}-\x{05AF}]"
Clipboard := RegExReplace(Clipboard,tRepl1,"")
Clipboard := RegExReplace(Clipboard,tRepl2,"")
}
destatez
Posts: 3
Joined: 24 Nov 2016, 16:50
GitHub: destatez

Re: How do I specify a Unicode string to RegExReplace?

25 Nov 2016, 16:43

Thanks. I'll keep that in mind for other functions. This one I want to be isolated from any other clipboard action

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], daiweisc, Rohwedder, Wigi and 131 guests