iOS Question Regex troubles

Discussion in 'iOS Questions' started by Semen Matusovskiy, Nov 10, 2019.

  1. Semen Matusovskiy

    Semen Matusovskiy Well-Known Member Licensed User

    Hi, guys --

    Just noticed ...
    Code:
    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: Nov 10, 2019
  2. emexes

    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.
     
  3. emexes

    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.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    The Regex feature is based on the native Regex engines so there might be some "edge" differences.

    I don't understand this pattern. What are you trying to match/
     
  5. emexes

    emexes Well-Known Member Licensed User

    upload_2019-11-11_21-29-50.png
     
  6. Semen Matusovskiy

    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 ?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Valid, standard patterns will work exactly the same. Edge cases, that usually have no meaning, can behave differently.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice