|
-
Oct 29th, 2012, 08:23 PM
#1
Thread Starter
PowerPoster
Regex and VB6
So I am trying to convert this from VB6 into C# but cannot figure out the Regex in C#.
Code:
if theData Like "[*]??????????????8" then
...
so in C#, what would the regex be?
I tried:
[*]??8
but this returns true even if it does not end in "8"
sure, could use the "string" way (get the last char and see if it is an 8 or use IndexOf) but that is not the best way and rather have Regex only.
Thanks
-
Oct 30th, 2012, 11:53 AM
#2
Re: Regex and VB6
csharp Code:
if (Regex.IsMatch(theData, "\\*.{14}8")) { //... }
should do the trick.
There are various additions like ^$ for beginning/end of string (singleline option), or grouping that could be used, but for this example, the base matching of asterisk following by 14 of any single char followed by 8, should be adequate.
Tom
In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|