Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8182927

Browse files
Xiretzagtjoseph
authored andcommitted
Fix formatting and copy-paste fail in dialplan expression docs
1 parent 60341fc commit 8182927

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

docs/Configuration/Dialplan/Expressions/Expressions-Examples.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ pageid: 4620379
77

88
| Expression | Result | Note |
99
| --- | --- | --- |
10-
| "One Thousand Five Hundred" =~ "(T[Expressions Examples^ ])" | Thousand | |
11-
| "One Thousand Five Hundred" =~ "T[Expressions Examples^ ]" | 8 | |
12-
| "One Thousand Five Hundred" : "T[Expressions Examples^ ]" | 0 | |
10+
| "One Thousand Five Hundred" =~ "(T[^ ])" | Thousand | |
11+
| "One Thousand Five Hundred" =~ "T[^ ]" | 8 | |
12+
| "One Thousand Five Hundred" : "T[^ ]" | 0 | |
1313
| "8015551212" : "(...)" | 801 | |
1414
| "3075551212":"...(...)" | 555 | |
15-
| ! "One Thousand Five Hundred" =~ "T[Expressions Examples^ ]" | 0 | Because it applies to the string, which is non-null, which it turns to "0", and then looks for the pattern in the "0", and doesn't find it |
16-
| !( "One Thousand Five Hundred" : "T[Expressions Examples^ ]+" ) | 1 | Because the string doesn't start with a word starting with T, so the match evals to 0, and the ! operator inverts it to 1 |
15+
| ! "One Thousand Five Hundred" =~ "T[^ ]" | 0 | Because it applies to the string, which is non-null, which it turns to "0", and then looks for the pattern in the "0", and doesn't find it |
16+
| !( "One Thousand Five Hundred" : "T[^ ]+" ) | 1 | Because the string doesn't start with a word starting with T, so the match evals to 0, and the ! operator inverts it to 1 |
1717
| 2 + 8 / 2 | 6 | Because of operator precedence; the division is done first, then the addition |
1818
| 2+8/2 | 6 | Spaces aren't necessary |
1919
| (2+8)/2 | 5 | |

docs/Configuration/Dialplan/Expressions/Operators.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ Operators are listed below in order of increasing precedence. Operators with equ
2020
* ! expr1
2121
Return the result of a logical complement of expr1. In other words, if expr1 is null, 0, an empty string, or the string "0", return a 1. Otherwise, return a 0. It has the same precedence as the unary minus operator, and is also right associative.
2222
* expr1 : expr2
23-
The `:' operator matches expr1 against expr2, which must be a regular expression. The regular expression is anchored to the beginning of the string with an implicit `'.
24-
25-
If the match succeeds and the pattern contains at least one regular expression subexpression `', the string corresponing to `\1' is returned; otherwise the matching operator returns the number of characters matched. If the match fails and the pattern contains a regular expression subexpression the null string is returned; otherwise 0.
26-
27-
Normally, the double quotes wrapping a string are left as part of the string. This is disastrous to the : operator. Therefore, before the regex match is made, beginning and ending double quote characters are stripped from both the pattern and the string.
28-
23+
The `:` operator matches expr1 against expr2, which must be a regular expression. The regular expression is anchored to the beginning of the string with an implicit `^`.
24+
If the match succeeds and the pattern contains at least one regular expression match group `()`, the string corresponing to `\1` is returned; otherwise the matching operator returns the number of characters matched. If the match fails and the pattern contains a regular expression match group the null string is returned; otherwise 0.
25+
Normally, the double quotes wrapping a string are left as part of the string. This is disastrous to the : operator. Therefore, before the regex match is made, beginning and ending double quote characters are stripped from both the pattern and the string.
2926
* expr1 =~ expr2
3027
Exactly the same as the ':' operator, except that the match is not anchored to the beginning of the string. Pardon any similarity to seemingly similar operators in other programming languages! The ":" and "=~" operators share the same precedence.
3128
* expr1 ? expr2 :: expr3

0 commit comments

Comments
 (0)