regex will search for instances of a string then remove certain characters

Capture all but double quotes and replace with backreferences:

Find: \b(setDates\()\\(".*?)\\("\))
Replace: $1$2

See proof

Explanation

--------------------------------------------------------------------------------
  \b                       the boundary between a word char (\w) and
                           something that is not a word char
--------------------------------------------------------------------------------
  (                        group and capture to \1:
--------------------------------------------------------------------------------
    setDates                 'setDates'
--------------------------------------------------------------------------------
    \(                       '('
--------------------------------------------------------------------------------
  )                        end of \1
--------------------------------------------------------------------------------
  \\                       '\'
--------------------------------------------------------------------------------
  (                        group and capture to \2:
--------------------------------------------------------------------------------
    "                        '"'
--------------------------------------------------------------------------------
    .*?                      any character except \n (0 or more times
                             (matching the least amount possible))
--------------------------------------------------------------------------------
  )                        end of \2
--------------------------------------------------------------------------------
  \\                       '\'
--------------------------------------------------------------------------------
  (                        group and capture to \3:
--------------------------------------------------------------------------------
    "                        '"'
--------------------------------------------------------------------------------
    \)                       ')'
--------------------------------------------------------------------------------
  )                        end of \3

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top