I have text:
https://youtu.be/iOA7NUI\-9Xhwvideo\-one\-
I need to replace \- to - with JS, so i get:
https://youtu.be/iOA7NUI-9Xhwvideo-one-
I have text:
https://youtu.be/iOA7NUI\-9Xhwvideo\-one\-
I need to replace \- to - with JS, so i get:
https://youtu.be/iOA7NUI-9Xhwvideo-one-
 
    
    Replace /(^|[^ ])\\-($|[^ ])/g by $1-$2.
$1 refers to the first capturing group (same for $2).

 
    
    Simply use replace method and use below regex to match \- only that contains in URL. I used the logic of space that is not there in URL.
\\-(?=\S)
Pattern explanation:
  \\                       '\'
  -                        '-'
  (?=                      look ahead to see if there is:
    \S                       non-whitespace (all but \n, \r, \t, \f, and " ")
  )                        end of look-ahead
 
    
    Use replace javascript method!
    text = text.replace('\-', '-');
