i would like to use the following regex in VB.net:
(\d+.\d+)|(\?\?\?\?\?\?)
how would i do it? i actually need to edit a string to put it in the specified format
i would like to use the following regex in VB.net:
(\d+.\d+)|(\?\?\?\?\?\?)
how would i do it? i actually need to edit a string to put it in the specified format
Dim isMatch As Boolean = _
System.Text.RegularExpressions.RegEx.IsMatch("My test string", _
"((\d+.\d+)|(\?\?\?\?\?\?))")
Note the extra parenthesis I added... I'm pretty sure they are needed, so both sides of the "or" ("|") are considered part of the same group.
It also looks like there may be an error in your expression in "\d+.\d+". If the "." you have there is intended to match a literal period, you should use "\." instead. Otherwise, the "." in RegEx lingo is a single-character wildcard.
(I'm assuming you're looking for a literal dot below...)
You could shorten your expression to this:
"((\d+\.\d+)|?{6})"
Question marks don't mean anything in RegEx in the spot they appear in the expression, so they don't have to be escaped with a backslash. The curly braces show the number of repetitions you want to find of the thing before it (the question mark).
Dim MyRegex As Regex = New Regex("(\d+.\d+)|(\?\?\?\?\?\?)") //construct a Regex object that you can call later