diff options
author | Craig Earls <enderw88@gmail.com> | 2014-07-03 19:13:58 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2014-07-03 19:13:58 -0700 |
commit | 86a191e6b9799428b3a5a73db840787992bd5fb7 (patch) | |
tree | f2f40bc7022b48d9589733f38328179b450aeee0 | |
parent | 746ca1fe6d15528b444f35e6a65d3c93e4976894 (diff) | |
parent | c5980f74913f6d0f5b852c5093b0bdac83566994 (diff) | |
download | fork-ledger-86a191e6b9799428b3a5a73db840787992bd5fb7.tar.gz fork-ledger-86a191e6b9799428b3a5a73db840787992bd5fb7.tar.bz2 fork-ledger-86a191e6b9799428b3a5a73db840787992bd5fb7.zip |
Merge pull request #307 from redstreet/master
Updated out of date value expression section in the documentation.
-rw-r--r-- | doc/ledger3.texi | 96 |
1 files changed, 74 insertions, 22 deletions
diff --git a/doc/ledger3.texi b/doc/ledger3.texi index a57d8376..c7613c0e 100644 --- a/doc/ledger3.texi +++ b/doc/ledger3.texi @@ -7857,48 +7857,100 @@ More complicated expressions are possible using: @table @code -@item NUM -A plain integer represents a commodity-less amount. - -@item @{AMOUNT@} -An amount in braces can be any kind of amount supported by ledger, +@item "amount == COMMODITY AMOUNT" +The amount can be any kind of amount supported by ledger, with or without a commodity. Use this for decimal values. @item /REGEX/ -@itemx W/REGEX/ +@itemx account =~ /REGEX/ A regular expression that matches against an account's full name. If a posting, this will match against the account affected by the posting. -@item //REGEX/ -@itemx p/REGEX/ +@item @@/REGEX/ +@itemx expr payee =~ /REGEX/ A regular expression that matches against a transaction's payee name. -@item ///REGEX/ -@itemx w/REGEX/ -A regular expression that matches against an account's base name. If -a posting, this will match against the account affected by the -posting. +@item %/REGEX/ +@itemx tag(REGEX) +A regular expression that matches against a transaction's tags. + +@itemx expr date =~ /REGEX/ +Useful for specifying a date in plain terms. For example, you could say +@samp{expr date =~ /2014/}. + + +@item expr comment =~ /REGEX/ +A regular expression that matches against a posting's comment field. This +searches only a posting's field, not the transaction's note or comment field. +For example, @samp{ledger reg "expr" "comment =~ /landline/"} will match: + +@smallexample +2014/1/29 Phone bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 ; landline bill +@end smallexample + +but will not match: + +@smallexample +2014/1/29 Phone bill ; landline bill + ; landline bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 +@end smallexample + +To match the latter, use @samp{ledger reg "expr" "note =~ /landline/"} +instead. + +@item expr note =~ /REGEX/ +A regular expression that matches against a transaction's note field. +This searches all comments in the transaction, including comments on +individual postings. Thus, @samp{ledger reg "expr" "note =~ /landline/"} will +match both all the three examples below: + +@smallexample +2014/1/29 Phone bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 ; landline bill +@end smallexample + +@smallexample +2014/1/29 Phone bill ; landline bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 +@end smallexample + +@smallexample +2014/1/29 Phone bill + ; landline bill + Assets:Checking $50.00 + Expenses:Phone $-50.00 +@end smallexample -@item c/REGEX/ -A regular expression that matches against the transaction code (the -text that occurs between parentheses before the payee). -@item e/REGEX/ -A regular expression that matches against a posting's note or -comment field. @item (EXPR) A sub-expression is nested in parenthesis. This can be useful passing more complicated arguments to functions, or for overriding the natural precedence order of operators. -@item [DATE] -Useful for specifying a date in plain terms. For example, you could say -@samp{[2004/06/01]}. + +@itemx expr base =~ /REGEX/ +A regular expression that matches against an account's base name. If +a posting, this will match against the account affected by the +posting. + +@itemx expr code =~ /REGEX/ +A regular expression that matches against the transaction code (the +text that occurs between parentheses before the payee). @end table +The @samp{query} command can be used to see how Ledger interprets your query. +This can be useful if you are not getting the results you expect. See +@pxref{Pre-Commands} for more. + @menu * Miscellaneous:: @end menu |