Regular expression, ^ begins with

I have string values:
strBody = “VEC_CASE1234”
strKeyWord =“VEC_CASE”

and then my match collection:
matchCollection = System.Text.RegularExpressions.Regex.Matches(strBody.ToUpper,“^”+strKeyword)
but when i run this I only get “VEC_CASE” in my match collection.
how can I code this so I get “VEC_CASE1234”?


If I understand your requirement correctly, the following will work. Can you try this?

matchCollection = System.Text.RegularExpressions.Regex.Matches(strBody.ToUpper,"^"+strKeyword+".*")


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.