iOS Question Regex troubles

Semen Matusovskiy

Well-Known Member
Licensed User
Hi, guys --

Just noticed ...
B4X:
Regex.IsMatch ("(.*?)", "12345678901")
In B4A 9.50 returns true. B4J (7.00) - also true. But in B4I (6.00) - false.
Can't say, which release is correct. Probably, B4I, because there is no $ at the end of pattern. But all releases should give the same result.
 
Last edited:

emexes

Well-Known Member
Licensed User
Well spotted :)

I would say that IsMatch should return True, because the ? means to take as few characters as possible to match the string, but doesn't specify a maximum, ie it can match all 11 digits of your sample string if that's what is needed.

If it meant to ONLY match as few characters as possible then it would only ever match one character.
 

emexes

Well-Known Member
Licensed User
Perhaps the difference is between the different "flavours" of regex, and Android is using Java-style and iOS is using Unix style.

I think www.regex101.com offers a choice of 4 styles. I am on a phone at the moment so cannot check.
 

Semen Matusovskiy

Well-Known Member
Licensed User
The situation is following. A project manager describes names, patterns etc. in control center on webserver. Mobile app receives a list of fields and does minimum logical
control using Regex.
I know nothing about Regex. Guess, a project manager knows even less. He simply searches an analog in Internet.

For me is important to find a compatible format for B4A and B4I. There are some websites which offer regex tests. But which works according our needs ?
 
Top