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

댓글 수: 7

madhan ravi
madhan ravi 2019년 2월 9일
Please upload the string you have and what result are you expecting ?
abdullah alzaqebah
abdullah alzaqebah 2019년 2월 11일
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
'?' '?' '?'
Adam Danz
Adam Danz 2019년 2월 11일
편집: Adam Danz 2019년 2월 11일
Works for me (it seems).
str='محمود طالب نجيب ومحمد طالب كسول ';
pattern='محم[و]*د';
>> regexp(str, pattern)
ans =
1 18
>> regexp(str, pattern, 'match')
ans =
1×2 cell array
{'محمود'} {'محمد'}
abdullah alzaqebah
abdullah alzaqebah 2019년 2월 11일
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
abdullah alzaqebah
abdullah alzaqebah 2019년 2월 11일
편집: abdullah alzaqebah 2019년 2월 11일
@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?
abdullah alzaqebah
abdullah alzaqebah 2019년 2월 11일
thanks all
i make it GUI and it works

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

질문:

2019년 2월 9일

댓글:

2019년 2월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by