D
darrel
I'm new to .net's regex capabilities. I've made a regex:
dim r as new regex( _
"(?<tagOpening>(<))" & _
"(?<theTag>(" & tagToFind & "))" & _
"(?<anything>(.[^>/]*))" & _
"(?<theAttribute>(" & attributeToFind & "))" & _
"(?<theEqualsSign>((\s*)=(\s*)))" & _
"(?<theAttributeValue>((.[^\s/>]*)))" _
, RegexOptions.IgnoreCase)
This should work.
Now, I have a string that I'd like to apply the above regex to, and then
replace one of the named groups with a new value. Can I just do this:
dim caption as String = r.replace(theAttributeValue, "10")
If so, then I think I just need the proper syntax to select the named group
in the regex.
However, I have a hunch that I need to do more than this. Maybe create a
match?
-Darrel
dim r as new regex( _
"(?<tagOpening>(<))" & _
"(?<theTag>(" & tagToFind & "))" & _
"(?<anything>(.[^>/]*))" & _
"(?<theAttribute>(" & attributeToFind & "))" & _
"(?<theEqualsSign>((\s*)=(\s*)))" & _
"(?<theAttributeValue>((.[^\s/>]*)))" _
, RegexOptions.IgnoreCase)
This should work.
Now, I have a string that I'd like to apply the above regex to, and then
replace one of the named groups with a new value. Can I just do this:
dim caption as String = r.replace(theAttributeValue, "10")
If so, then I think I just need the proper syntax to select the named group
in the regex.
However, I have a hunch that I need to do more than this. Maybe create a
match?
-Darrel