Link to home
Start Free TrialLog in
Avatar of ty-exexch-ko
ty-exexch-koFlag for Albania

asked on

Display arabic alphabet with Vb.Net

I'm use this statement to display english alphabet but I want to display arabic alphabet

Dim words As MatchCollection = Regex.Matches(text, "\b[a-zA-Z]+\b")

Open in new window

Avatar of kaufmed
kaufmed
Flag of United States of America image

I'm confused. You say you are displaying an English alphabet, but you are showing a regex, which would be used to match patterns, or in this case English letters. Are you saying you want to match Arabic characters? If so, you should be able to just paste in the range using charmap (or if you have an Arabic keyboard). You'll probably need to set the RightToLeft option on your regex.

Here is an example--forgive me, I cannot read Arabic, so this may not make sense as I pulled it from the following site:  http://www.shariahprogram.ca/Arabic-alphabet.shtml

Please note the structure of the code (I am including an image in case EE doesn't display the characters properly). It also seems that word boundary has an issue with Arabic script. I may be doing something incorrectly though. You'll have to experiment with that part of the pattern.
string text = "¿¿¿ ¿¿¿¿ ¿¿¿¿ ¿¿¿¿";
MatchCollection words = Regex.Matches(text, "[¿-¿]+");

Open in new window

Untitled.png
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The VB version:
Dim text As String = "¿¿¿ ¿¿¿¿ ¿¿¿¿ ¿¿¿¿"
Dim words As MatchCollection = Regex.Matches(text, "[¿-¿]+")

Open in new window

Avatar of ty-exexch-ko

ASKER

I will test this code and return back.