How to replace string between two characters with Regex?
hello!
in application have string "sentence 1 rule id: whitespace_rule message: text..."
or string "sentence 2 rule id: morfologik_rule message: text..."
i want replace this: "rule id: some_rule message", want change first string to "sentence 1: text..." , second string to: "sentence 2: text..."
how using regex?
hi, try this:
string s = "sentence 1 rule id: whitespace_rule message: text..."; s = regex.replace(s, "rule id:[^:]*:", ":");
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment