Merge pull request #3135 from leviding/patch-5

fix: shash -> backslash
This commit is contained in:
Ilya Kantor 2022-08-14 14:32:13 +03:00 committed by GitHub
commit 12cc61f7f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
Create a regexp to find strings in double quotes `subject:"..."`. Create a regexp to find strings in double quotes `subject:"..."`.
The strings should support escaping, the same way as JavaScript strings do. For instance, quotes can be inserted as `subject:\"` a newline as `subject:\n`, and the slash itself as `subject:\\`. The strings should support escaping, the same way as JavaScript strings do. For instance, quotes can be inserted as `subject:\"` a newline as `subject:\n`, and the backslash itself as `subject:\\`.
```js ```js
let str = "Just like \"here\"."; let str = "Just like \"here\".";
@ -18,11 +18,11 @@ Examples of strings to match:
```js ```js
.. *!*"test me"*/!* .. .. *!*"test me"*/!* ..
.. *!*"Say \"Hello\"!"*/!* ... (escaped quotes inside) .. *!*"Say \"Hello\"!"*/!* ... (escaped quotes inside)
.. *!*"\\"*/!* .. (double slash inside) .. *!*"\\"*/!* .. (double backslash inside)
.. *!*"\\ \""*/!* .. (double slash and an escaped quote inside) .. *!*"\\ \""*/!* .. (double backslash and an escaped quote inside)
``` ```
In JavaScript we need to double the slashes to pass them right into the string, like this: In JavaScript we need to double the backslashes to pass them right into the string, like this:
```js run ```js run
let str = ' .. "test me" .. "Say \\"Hello\\"!" .. "\\\\ \\"" .. '; let str = ' .. "test me" .. "Say \\"Hello\\"!" .. "\\\\ \\"" .. ';