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

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'