1
Answer

RegEx trouble - need help matching a string

Tom Stephenson

Tom Stephenson

18y
2.4k
1
Hi there, I am passing a selected area of text as a string (from an IDE text editor) and attempting to match it against a textfile using the following regex : Regex targetExpOld = new Regex(@"^\s+"+content+ @"\s+$", RegexOptions.Multiline); if content = "int i = 6;" i get a match however if content contains a "." or a "(" it doesnt find a match any idea how i can dodge this - i realise its a problem with special characters but I'm new to regex and dont have time to become an expert!(just yet) kind regards Tom
Answers (1)