Regex ?

Theera

Well-Known Member
Licensed User
Longtime User
Hi all,
Who is well known about Regex in B4A? Please explain me clearly?
Could I match Thaiword with mp3 File? I don't know about using pattern.

Best Regards
Theera
 
Last edited:

Theera

Well-Known Member
Licensed User
Longtime User
Please give me the example: IsThai(word) as boolean?

I don't know to use regex ? This is Thai unicode.
Please help me give example i.e. How to coding function IsThai(word) as boolean ?

P.S. Unicode Thai(UTF-8) is the same as Unicode Thai(UTF-8 without BOM)?

Best Regards
Theera
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You do not need to use Regex for this. You should check the value returned from Asc(SomeCharacter) and see whether it is in the block of Thai characters.

Something like:
B4X:
Sub IsThai(s As String) As Boolean
   For i = 0 To s.Length - 1
      Dim codePoint As Int = Asc(s.CharAt(i))
      If codePoint >= 0x0E00 AND codePoint <= 0x0E7F Then Return True
   Next
   Return False
End Sub
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Can I use pattern with regex()?

Hi Erel,
I have ever seen Java using Pattern, Pattern="[ก-ฮ0-9ฯ-๙]*"
I don't know that Can I use pattern with regex()? If I can,then
if I define "เอาะ"="-oh" then "เกาะ"="Koh" too. How to coding?

P.S. "เกาะ" is mean "land"

Best Regards
Theera
 
Last edited:
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Ask to learn more.

Hi Erel,
Is there a possibility or not that made error?,If I check many languages in your strategy post #4. I mean that data of langauges used in the same location between 0x0E00-0x0E7F.

Best Regards
Theera
 
Last edited:
Upvote 0
Top