Regex Pattern Question

Is it possible to create a Regex pattern that match under the following situation?

String to Search = T.TestString
Possible Matching Search Input Strings = T.TestString, TestString

However I only want the T.TestString to match so I can replace the string.  Otherwise the replacement would be incorrect.
WH_TechAsked:
Who is Participating?
 
Terry WoodsConnect With a Mentor IT GuruCommented:
You should be able to do a regex replace with pattern:
T\.TestString(?=, TestString)

Open in new window


The (?=...) part is a positive lookahead
0
 
ozoConnect With a Mentor Commented:
^T\.TestString
0
 
käµfm³d 👽Commented:
Are you performing the replacement in C#, or in Visual Studio (or another IDE or text editor)? If Visual Studio, what version are you using?
0
 
WH_TechAuthor Commented:
VS 2013 (C#)
0
 
käµfm³d 👽Commented:
Then what was proposed above should be fine. Earlier versions of VS had their own unique regex syntax for Find/Replace. VS 2012 and VS 2013 both use PCRE.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.