LIKE operator - any number of digits (not *) 
Author Message
 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  
 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  
 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  
 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  
 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?

> > From MSDN Library:

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



Sat, 05 Feb 2005 01:59:01 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Setting AutoNumber to any Number/digits

2. Replacing digits[space] with digits[non-breaking space]

3. Date function: Number of digits for the year.

4. Detecting number of digits after decimal point

5. Constant number of digits after the decimal point

6. ActiveX dll allowing math on 1000+ digit numbers - betatesters needed

7. Generate a list of all possible 9-digit number

8. 4-digit years-ccyy in Cdate() (returned as 2-digit years-yy)

9. Help... random numbers of 6 digits

10. formatting a string with x number of digits

11. does not print digits to the right if $.00

12. digit grouping symbol when not needed

 

 
Powered by phpBB® Forum Software