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

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user