Jump to content

Regular expression


Recommended Posts

I need to set up a regular expression to check a series of strings.The following:

1:h2

2-9:div

10-:P

should all evaluate to true. I tried using:

If StringRegExp($teststring, "\A[:digit:]{1,}\-{0,}[:digit:]{0,}\:[:alnum:]{1,}\Z") Then

- string is ok -

Else

- string is not ok -

EndIf

but it doesn't seem to work. Any help gratefully received!

Edited by philw
Link to comment
Share on other sites

Hi,

okay, so what a the rules?

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

okay, so what a the rules?

Mega

Start of string

A number (1 or more characters)

Possibly followed by a single hyphen

Possibly followed by another number (1 or more characters)

Must be followed by a single colon

Must be followed by one or more alphanumeric characters

End of string

And with no spaces anywhere.

Link to comment
Share on other sites

\d+[-\d]*:\w+

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

No prob. Hopefully it does what you need.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...