Jump to content

Regex for selecting DB entry starting with any number...


kabbink

Recommended Posts

Hello all,

Sorry I am a total regexp noob and my question will probably take any one of you only a few seconds.  Im sure it has been asked before but I tried searching and couldnt find it.  This might be a good one to add to the "Common Expressions" thread.

Anyway all I am trying to do is select from a MySQL database any entry that starts with any number....

My query will look like this
$sql = "SELECT * FROM members WHERE company LIKE '[b]regexp[/b]' ORDER BY company";

Thanks for the help on this mundane questions...
Kevin
Link to comment
Share on other sites

Hello and thanks for the reply...

So do I need to do something like this:

SELECT * FROM members WHERE company LIKE '^[0-9]%'

I need to select everything from my members database where the company field [i]begins[/i] with a number.

The above query yields no results so obviously I am doing something wrong...

Sorry for not understanding your first answer.
Kevin
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.