ElCapitaine
ElCapitaine

Reputation: 850

Regex problem in vb.net

I'm trying to create a regex that will matches with

"8-9."

but won't matches with

"8-9........"

I tried lots of possibilities yet, but still can't find the right one.

Upvotes: 0

Views: 109

Answers (2)

i100
i100

Reputation: 4666

try

Dim r As Regex = New Regex("8\-9")
'Look for match
Dim m As Match = r.Match(mystring)

also might use

Dim r As Regex = New Regex("^8\-9$")

if you want a single word

Upvotes: 1

Blindy
Blindy

Reputation: 67380

Without a better worded question, ^8-9$ should do it..

Upvotes: 2

Related Questions