c# - Replace certain string if it has a matching string after it? -


i have string this:

this'is'my' test' string' 

i need find , replace prefer using regex, on '.

i need replace ' '\r\n, not change other lines have line spacing, make this:

this' is' my' test' string' 

i can't remove "\r\n"'s , change them all, need quick , change needed changed.

currently doing this:

var escapecharactor = "?" var lineendcharactor = "'"  string result = regex.replace(data, @"(([^\" + escapecharactor + "]" + lineendcharactor + @"[^\r\n|^\r|^\n])|(\" + escapecharactor + @"\" + escapecharactor + lineendcharactor + "[^\r\n|^\r|^\n]))", "$1\r\n"); return edidataunwrapped; 

but creating this:

this'i s'm y' test' string' 

is possible alter ones , not include letter or going have manage removing \r\n's , adding of them?

here non-regex approach:

string teststring = @"this'is'my' test' string'";  var split = teststring.split(new[]{"'"}, stringsplitoptions.removeemptyentries)     .select(s => s.trim() + "'"); teststring = string.join(environment.newline, split); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -