SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member gekko's Avatar
    Join Date
    Aug 2001
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wild card for numbers?

    I'm trying to grab all titles that start with a number, any number. I'm trying to find if there's a wild card for numbers, so I could do something like "SELECT... LIKE #%".

    I somehow don't think the best way we be to do LIKE 1% OR 2% OR, etc.

    I'm using PostgreSQL if it matters.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,245
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    something like this (can't test, don't have postgresql) --

    ... WHERE column SIMILAR TO '^[[:digit:]]'

    see http://www.postgresql.org/docs/8.1/i...MILARTO-REGEXP
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member gekko's Avatar
    Join Date
    Aug 2001
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The query is valid, but I'm not returning any results. Same thing if I try to use [0-9].

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    try '^\S*[0-9]'

  5. #5
    SitePoint Member gekko's Avatar
    Join Date
    Aug 2001
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, still didn't work. Same problem.

    I'll be moving to PostgreSQL 8.1 soon, and I'll give the ::digit:: thing another try. Until then, if anyone has more ideas, please let me know.


Bookmarks

Posting Permissions

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