mIRC Home    About    Download    Register    News    Help

Print Thread
#254485 13/08/15 01:14 PM
Joined: Dec 2002
Posts: 9
G
gahalle Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Dec 2002
Posts: 9
Is $regsub currently not supposed to be handling unicode at all, even with the /u switch?
(With or without u specified seems to make no difference)

Trying to escape (\) non-alphabet characters in a string with code similar to this one (inside an alias):
Code:
var %txt = José the Jalapeño
var %txt2 = $regsub(%txt,/([^a-zA-Z ])/gu,\\\1,%txt)
return %txt

Expected %txt = Jos\é the Jalape\ño
Returned %txt = Jos\Ã\© the Jalape\Ã\±o

I may, of course, be approaching this wrong, so any tips or suggestions is welcomed.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
/(*utf)([^a-zA-Z ])/g

Last edited by Loki12583; 13/08/15 02:02 PM.
Joined: Dec 2002
Posts: 9
G
gahalle Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Dec 2002
Posts: 9
Thank you for pointing me in the right direction.
I'm afraid /(*utf)([^a-zA-Z ])/g didn't appear to escape accented characters as I intended.

However, I stumbled upon trying /([^a-zA-Z0-9 ][^\X])/g which returns the string the way I want it. Will need to test it further to make sure it won't break something else.

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
The token is case sensitive and should be uppercase: (*UTF)


Saturn, QuakeNet staff
Joined: Dec 2002
Posts: 9
G
gahalle Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
G
Joined: Dec 2002
Posts: 9
Adding (*UTF) in uppercase does exactly what I had in mind.

Many thanks, Loki and Sat
d-(",)z


Link Copied to Clipboard