Short Version: I am trying to build the regex to find out if a string contains "0,0,0,0". Every attempt I have made only returns each char as a match not the full string within the quotes.
I am trying to find certain text within a string inside of a textbox in vb.net. My issue is that instead of returning one match it is returning each char within the string as a match. Now normally I would figure it is an issue with my regex but since I have verified it should work with a couple online tools I am not 100% sure.
The string I am trying to match is: 0,0,0,0
The string I am trying to find the match in would look like this: Image(0,0,0,0,"Path")
I am using a control called fastcoloredtextbox and it allows to set ranges for color styling and other custom styles for specific strings. Below is how I usually add style ranges.
Currently I have added the ability to make words clickable so I am trying to get the regex to build matches for the strings I want to make clickable. Ex:
Can anyone see a problem with my regex?
I am trying to find certain text within a string inside of a textbox in vb.net. My issue is that instead of returning one match it is returning each char within the string as a match. Now normally I would figure it is an issue with my regex but since I have verified it should work with a couple online tools I am not 100% sure.
The string I am trying to match is: 0,0,0,0
The string I am trying to find the match in would look like this: Image(0,0,0,0,"Path")
I am using a control called fastcoloredtextbox and it allows to set ranges for color styling and other custom styles for specific strings. Below is how I usually add style ranges.
Currently I have added the ability to make words clickable so I am trying to get the regex to build matches for the strings I want to make clickable. Ex:
Code:
Private Sub tb_textchanged(ByVal sender As System.Object, ByVal e As TextChangedEventArgs)
' This is working code to make the word Path clickable in the above string:
e.ChangedRange.SetStyle(ellipseStyle, "\bPath\b", RegexOptions.IgnoreCase)
' When I use these ones it returns each character as a match and not the full string. The mystery...
'First attempt
e.ChangedRange.SetStyle(ellipseStyle, "0,0,0,0", RegexOptions.IgnoreCase)
''Second attempt
e.ChangedRange.SetStyle(ellipseStyle, "0\,0\,0\,0", RegexOptions.IgnoreCase)
'''Third attempt
e.ChangedRange.SetStyle(ellipseStyle, "(0,){4}", RegexOptions.IgnoreCase)
End Sub