Regex problems with non-ascii characters

peter

Пользователь
Регистрация
07.01.2012
Сообщения
40
Благодарностей
2
Баллы
8
Hi,

ZP behaves quite weird when a regexp expression has certain non-ASCII characters. Just one example: when the ellipsis is not written with three points like ... but with the proper character: …
I have attached an example file plus a screenshot of its result. You can see that only one character is replaced, while the others are intact.

Are you aware of the problem?
Thanks!
 

Вложения

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
786
Баллы
113
use System.Text.RegularExpressions.Regex
it works fine
 

peter

Пользователь
Регистрация
07.01.2012
Сообщения
40
Благодарностей
2
Баллы
8
LexxWork, Thank you for your quick reply & workaround! May I have some more questions?
- could you just paste the code I should use in the c# block?
- what is your experience, are these kind of c#-based regex matches faster than the ”normal” regex?
 

LexxWork

Client
Регистрация
31.10.2013
Сообщения
1 190
Благодарностей
786
Баллы
113
simple code
C#:
string your_variable = project.Variables["text"].Value; // "…………………"
return System.Text.RegularExpressions.Regex.Replace(your_variable, "…", "-");
 
  • Спасибо
Реакции: peter

peter

Пользователь
Регистрация
07.01.2012
Сообщения
40
Благодарностей
2
Баллы
8
LexxWork, большое спасибо! It works - also checked whether it is faster than the build regex match, ...just for the record, found no difference.
 

peter

Пользователь
Регистрация
07.01.2012
Сообщения
40
Благодарностей
2
Баллы
8
Anyway, it would be nice to have this bug fixed. Thanks!
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113

peter

Пользователь
Регистрация
07.01.2012
Сообщения
40
Благодарностей
2
Баллы
8
Ooops, I am sorry, then the problem was located between the chair and the keyboard.. ;-)
Anyway this was an example file just to illustrate the problem. I do have had some oddities with regexps, but 'll try to investigate it further so that I could reproduce it, sorry for this again.
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 707
Баллы
113
We do not use any special lib for reg expressions. standard NET
i doubt there are any errors. anyway, any particular example is welcomed.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)