regex for arabic text

i want to use regexp for arabic text. what i should do? use the unicode or what?

7 个评论

Please upload the string you have and what result are you expecting ?
the orginal string like
str='محمود طالب نجيب ومحمد طالب كسول ';
pattern='محم[و]*د';
matchStr = regexp(str,pattern,'match');
the output of matchstr after run it is:
matchStr =
Columns 1 through 23
'?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?' '?'
Columns 24 through 26
'?' '?' '?'
Works for me (it seems).
str='محمود طالب نجيب ومحمد طالب كسول ';
pattern='محم[و]*د';
>> regexp(str, pattern)
ans =
1 18
>> regexp(str, pattern, 'match')
ans =
1×2 cell array
{'محمود'} {'محمد'}
yes if you type it in command window.
but try to put these three line of codes in file like test.m and try to run it
@Stephen
but wht it works when i type it in command window. and not working when i write all code as script in .m file?
thanks all
i make it GUI and it works

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by