Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. js = Regex.Replace(js, "(?<='[^'\n]*)(?<!\\\\)(\"|\\\\')(?=[^'\n]*')", "\\\""); //escape all nested "
  2. js = Regex.Replace(js, "'(?=([^'\n]*((?<=\\\\)\")?[^'\n]*'))", "\""); //replace first ' by " when next symbols contains  \", and ' at the end
  3. js = Regex.Replace(js, "(?<=(\\\"[^'\n]*((?<=\\\\)\")?[^'\n]*))'", "\""); //replace last ' when prev symbols contains escaped ", and ' at the start
  4. js = Regex.Replace(js, "(?<=\".*)\\\\\"(?=.*\")", "'"); //replace all \" by ' that located between " "
  5.  
  6. js = Regex.Replace(js, "(?<=`[^`\n]*)(?<!\\\\)\"(?=[^`\n]*`)", "\\\""); //escape all nested "
  7. js = Regex.Replace(js, "`(?=([^`\n]*((?<=\\\\)\")?[^`\n]*`))", "\""); //replace first ' by " when next symbols contains  \", and ' at the end
  8. js = Regex.Replace(js, "(?<=(\\\"[^`\n]*((?<=\\\\)\")?[^`\n]*))`", "\""); //replace last ' when next symbols contains escaped ", and ' at the start
  9. js = Regex.Replace(js, "(?<=\".*)\\\\\"(?=.*\")", "'"); //replace all \" by ' that located between " "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement