;doc: special characters: clarify windows differences
This commit is contained in:
parent
1fa8b79640
commit
391bd6fac9
@ -273,7 +273,7 @@ feel free to skip these until you need them.
|
|||||||
|
|
||||||
## Special characters
|
## Special characters
|
||||||
|
|
||||||
### Single escaping (shell metacharacters)
|
### Single escaping (for shell metacharacters)
|
||||||
|
|
||||||
In shell command lines, characters significant to your shell - such as
|
In shell command lines, characters significant to your shell - such as
|
||||||
spaces, `<`, `>`, `(`, `)`, `|`, `$` and `\` - should be
|
spaces, `<`, `>`, `(`, `)`, `|`, `$` and `\` - should be
|
||||||
@ -281,6 +281,12 @@ spaces, `<`, `>`, `(`, `)`, `|`, `$` and `\` - should be
|
|||||||
enclosing them in single or double quotes, or by writing a backslash
|
enclosing them in single or double quotes, or by writing a backslash
|
||||||
before them. Eg to match an account name containing a space:
|
before them. Eg to match an account name containing a space:
|
||||||
|
|
||||||
|
```cli
|
||||||
|
$ hledger register "credit card"
|
||||||
|
```
|
||||||
|
|
||||||
|
or:
|
||||||
|
|
||||||
```cli
|
```cli
|
||||||
$ hledger register 'credit card'
|
$ hledger register 'credit card'
|
||||||
```
|
```
|
||||||
@ -291,11 +297,17 @@ or:
|
|||||||
$ hledger register credit\ card
|
$ hledger register credit\ card
|
||||||
```
|
```
|
||||||
|
|
||||||
Windows users should keep in mind that `cmd` treats single quote as a
|
### Escaping on Windows
|
||||||
regular character, so you should be using double quotes exclusively.
|
|
||||||
PowerShell treats both single and double quotes as quotes.
|
|
||||||
|
|
||||||
### Double escaping (regular expression metacharacters)
|
If you are using hledger on Microsoft Windows, unless you are using a Unix-like shell (such Windows Subsystem for Linux),
|
||||||
|
be aware that the escaping rules are different. In particular:
|
||||||
|
|
||||||
|
- In a powershell window (`powershell`, blue background), you must use double quotes or single quotes (not backslash).
|
||||||
|
- In a command window (`cmd`, black background), you must use double quotes (not single quotes or backslash).
|
||||||
|
|
||||||
|
The following sections assume a Unix-like shell, and will need to be adapted if you're using `cmd` or `powershell`. (Edits welcome.)
|
||||||
|
|
||||||
|
### Double escaping (for regular expression metacharacters)
|
||||||
|
|
||||||
Characters significant in [regular expressions]
|
Characters significant in [regular expressions]
|
||||||
(described below) - such as `.`, `^`, `$`, `[`, `]`, `(`, `)`, `|`,
|
(described below) - such as `.`, `^`, `$`, `[`, `]`, `(`, `)`, `|`,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user