Regular Expresions

Regular Expresions

Anonymous
Not applicable
406 Views
3 Replies
Message 1 of 4

Regular Expresions

Anonymous
Not applicable
This is probably a dumb question, but I'll ask it anyhow. Can you use
regular expressions in vba? I'd like to use something similar to the
following to verify a valid entry of a scale on a userform.

^[0-9]{1}=[0-9]{1}$|^[0-9]{1}=[0-9]{2}$|^[0-9]{1}=[0-9]{3}$

--
Tim Riley
0 Likes
407 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
yes,
add reference to Microsoft VBScript Regular Expressions 5.5

Set oRegExp = CreateObject("VBScript.RegExp")
oRegExp.IgnoreCase = True
oRegExp.Global = True
oRegExp.MultiLine = True
oRegExp.Pattern =
"^[0-9]{1}=[0-9]{1}$|^[0-9]{1}=[0-9]{2}$|^[0-9]{1}=[0-9]{3}$"

"Tim Riley" wrote in message
news:[email protected]...
>
> This is probably a dumb question, but I'll ask it anyhow. Can you use
> regular expressions in vba? I'd like to use something similar to the
> following to verify a valid entry of a scale on a userform.
>
> ^[0-9]{1}=[0-9]{1}$|^[0-9]{1}=[0-9]{2}$|^[0-9]{1}=[0-9]{3}$
>
> --
> Tim Riley
>
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
Awesome....Thank you.

--
Tim Riley



"Mark Propst" wrote in message
news:[email protected]...
> yes,
> add reference to Microsoft VBScript Regular Expressions 5.5
>
> Set oRegExp = CreateObject("VBScript.RegExp")
> oRegExp.IgnoreCase = True
> oRegExp.Global = True
> oRegExp.MultiLine = True
> oRegExp.Pattern =
> "^[0-9]{1}=[0-9]{1}$|^[0-9]{1}=[0-9]{2}$|^[0-9]{1}=[0-9]{3}$"
>
> "Tim Riley" wrote in message
> news:[email protected]...
> >
> > This is probably a dumb question, but I'll ask it anyhow. Can you use
> > regular expressions in vba? I'd like to use something similar to the
> > following to verify a valid entry of a scale on a userform.
> >
> > ^[0-9]{1}=[0-9]{1}$|^[0-9]{1}=[0-9]{2}$|^[0-9]{1}=[0-9]{3}$
> >
> > --
> > Tim Riley
> >
> >
>
>
0 Likes
Message 4 of 4

Anonymous
Not applicable
I'll pass along the thanks to "ljb" who turned me on to regexp's
of course the settings:
> > oRegExp.IgnoreCase = True
> > oRegExp.Global = True
> > oRegExp.MultiLine = True
depend on what you want to do, they were just in the sample i cut and pasted
from

"Tim Riley" wrote in message
news:[email protected]...
> Awesome....Thank you.
>
0 Likes