|
-
Apr 7th, 2004, 06:13 PM
#1
Thread Starter
New Member
Regex match conversion
I am trying to change the string I get from a Regex match. I keep getting an invalid cast from a Match object to a string. I am fairly new to this so any help is appreciated.
Code:
rghfinMatch = (rghfinRegex.Match(strTool))
rghfinStrip = Microsoft.VisualBasic.Left(CStr(rghfinMatch), 1)
Thanks in adavnce,
Wil
-
Apr 7th, 2004, 06:41 PM
#2
I wonder how many charact
VB Code:
rghfinMatch = (rghfinRegex.Match(strTool))
rghfinStrip = Microsoft.VisualBasic.Left(CStr(rghfinMatch[b].Value[/b]), 1)
I don't know what else you attempting to do with it, so I didn't change any other code except that in bold.
-
Apr 7th, 2004, 06:45 PM
#3
Thread Starter
New Member
Thank you that is exactly what I was missing.
Wil
-
Apr 7th, 2004, 06:50 PM
#4
I wonder how many charact
I would also replace the second line, with more .Net standard functions...
VB Code:
Dim rghfinStrip As String = rghfinMatch.Value.Chars(0)
-
Apr 7th, 2004, 07:15 PM
#5
Thread Starter
New Member
The last piece of code would work if in the cases I only need the a single Char. I have other times I will need parts of the matches that have to be determined at run time. Is there any other way of wrting this code.
Code:
sineMatch = CStr((sineRegex.Match(strTool).Value))
sineStrip = Microsoft.VisualBasic.Left(sineMatch, (sineMatch.Length - 4))
The project I am wrting is to evaluate string and create formated names from them with only certain parts being used in the final name.
Wil
-
Apr 7th, 2004, 07:20 PM
#6
I wonder how many charact
VB Code:
sineStrip = sineMatch.Value.SubString(0, sineMatch.Length - 4)
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
|