Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts

    string contains regex , like ?

    string:
    ',12,13,14,15,'

    how to figure out that it contains 13 and 15 ?
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts
    You can go with either one.

    SELECT * FROM table WHERE string LIKE '%13%

    or

    SELECT * FROM table WHERE string REGEXP '.*13.*'

  • #3
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts
    Quote Originally Posted by BubikolRamios View Post
    how to figure out that it contains 13 and 15 ?
    The 13 is easy. But 13 and 15 ?
    Besides '%...%' is very slow, barely usable, that is, not usable at all, at least on MySql.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,546
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Oh, both...

    Then just do AND string REGEXP '.*15.*'

    As for using LIKE, I know its slower then other things, but barely if not useable in mySQL? I've been using it for a while with no notable issues.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •