C# conditional regex -


i new conditional regex , not sure how achieve below

input string - "test \n string \n\r"

output string - "test r string \n\r"

would replace \n 'r' , leave is, if \n\r

thanks, arthi

you can use negative lookbehind:

regex.replace(string, @"(?s)(?<!\r)\n", "r"); 

this replace \n when not preceded \r


Popular posts from this blog

javascript - Js, document.getElementById("ID").innerHTML, error -

jquery - jqGrid update specific column data with out refreshing the entire column? -

objective c - Is there a way in OCMockito to make stubs fail when an unknown method is called? -