LIKE operator - any number of digits (not *)

Is there a way with the Like operator to indicate any number of digits (#) instead of any number of characters?

What I want is similar to:

If X Like "C_VER_#" Then

Except that I want the # to be 1 or more digits instead of just one digit. I can't use * because then it would match alphabetic and special characters as well. Is there a way to do this using the Like operator syntax?

From MSDN Library:

* Zero or more characters # Any single digit (0-9)

Mon, 31 Jan 2005 03:25:17 GMT

David William#2 / 5

LIKE operator - any number of digits (not *)

You can always do something like this:

If X Like "C_VER_#*" then

to accomplish your requirements.

HTH

David

Quote:

> Is there a way with the Like operator to indicate any number of digits (#) > instead of any number of characters?

> What I want is similar to:

> If X Like "C_VER_#" Then

> Except that I want the # to be 1 or more digits instead of just one digit. > I can't use * because then it would match alphabetic and special characters > as well. Is there a way to do this using the Like operator syntax?

> From MSDN Library:

> * Zero or more characters > # Any single digit (0-9)

Mon, 31 Jan 2005 20:36:22 GMT

ólafur ?rn Jónsso#3 / 5

LIKE operator - any number of digits (not *)

You can use regular expressions for this

Something like this

^C_VER_[0-9]*$

Check the Regex class

Quote:

> Is there a way with the Like operator to indicate any number of digits (#) > instead of any number of characters?

> What I want is similar to:

> If X Like "C_VER_#" Then

> Except that I want the # to be 1 or more digits instead of just one digit. > I can't use * because then it would match alphabetic and special characters > as well. Is there a way to do this using the Like operator syntax?

> From MSDN Library:

> * Zero or more characters > # Any single digit (0-9)

Mon, 31 Jan 2005 20:43:26 GMT

Russell Livel#4 / 5

LIKE operator - any number of digits (not *)

I thought about looking into regular expressions, but I had never used them before and was just checking to see if the Like operator could accomplish this instead of going to regex. This will be the only place in the application where this kind of processing will be necessary and it is quite a simple query, so I thought regex was overkill.

Thanks for the idea, I'll probably have to go to regex at some point Russell

Quote:

> You can use regular expressions for this

> Something like this

> ^C_VER_[0-9]*$

> Check the Regex class

> > Is there a way with the Like operator to indicate any number of digits (#) > > instead of any number of characters?

> > What I want is similar to:

> > If X Like "C_VER_#" Then

> > Except that I want the # to be 1 or more digits instead of just one digit. > > I can't use * because then it would match alphabetic and special > characters > > as well. Is there a way to do this using the Like operator syntax?

> > From MSDN Library:

> > * Zero or more characters > > # Any single digit (0-9)

Sat, 05 Feb 2005 02:00:44 GMT

Russell Livel#5 / 5

LIKE operator - any number of digits (not *)

That's an idea. It won't check that all the characters following VER_ are numeric but at least the first one will be required to be a digit. This may work well enough to suit our purposes.

Thanks for the response, Russell

Quote:

> You can always do something like this:

> If X Like "C_VER_#*" then

> to accomplish your requirements.

> HTH

> David

> > Is there a way with the Like operator to indicate any number of digits (#) > > instead of any number of characters?

> > What I want is similar to:

> > If X Like "C_VER_#" Then

> > Except that I want the # to be 1 or more digits instead of just one digit. > > I can't use * because then it would match alphabetic and special > characters > > as well. Is there a way to do this using the Like operator syntax?