简体   繁体   English

vb.net中的正则表达式问题

[英]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. 我尝试了很多可能性,但仍然找不到合适的可能性。

如果没有措辞更好的问题, ^8-9$应该这样做。

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 如果你想一个字

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM