1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 03:33:12 +02:00

core: add include comparison operators in evaluation of expressions

New comparison operators:

- "==*": is matching mask, case sensitive (wildcard "*" is allowed)
- "!!*": is NOT matching mask, case sensitive (wildcard "*" is allowed)
- "==-": is included, case sensitive
- "!!-": is NOT included, case sensitive
- "=-": is included, case insensitive
- "!-": is NOT included, case insensitive
This commit is contained in:
Sébastien Helleu
2020-05-05 20:43:45 +02:00
parent 8df8d20f81
commit b1c3a29ac7
28 changed files with 918 additions and 422 deletions
+24 -13
View File
@@ -7364,19 +7364,29 @@ command_init ()
"separated by semicolons\n"
" operator: a logical or comparison operator:\n"
" - logical operators:\n"
" && boolean \"and\"\n"
" || boolean \"or\"\n"
" && boolean \"and\"\n"
" || boolean \"or\"\n"
" - comparison operators:\n"
" == equal\n"
" != not equal\n"
" <= less or equal\n"
" < less\n"
" >= greater or equal\n"
" > greater\n"
" =~ is matching POSIX extended regex\n"
" !~ is NOT matching POSIX extended regex\n"
" =* is matching mask (wildcard \"*\" is allowed)\n"
" !* is NOT matching mask (wildcard \"*\" is allowed)\n"
" == equal\n"
" != not equal\n"
" <= less or equal\n"
" < less\n"
" >= greater or equal\n"
" > greater\n"
" =~ is matching POSIX extended regex\n"
" !~ is NOT matching POSIX extended regex\n"
" ==* is matching mask, case sensitive "
"(wildcard \"*\" is allowed)\n"
" !!* is NOT matching mask, case sensitive "
"(wildcard \"*\" is allowed)\n"
" =* is matching mask, case insensitive "
"(wildcard \"*\" is allowed)\n"
" !* is NOT matching mask, case insensitive "
"(wildcard \"*\" is allowed)\n"
" ==- is included, case sensitive\n"
" !!- is NOT included, case sensitive\n"
" =- is included, case insensitive\n"
" !- is NOT included, case insensitive\n"
"\n"
"An expression is considered as \"true\" if it is not NULL, not "
"empty, and different from \"0\".\n"
@@ -7465,7 +7475,8 @@ command_init ()
" /eval -n -c abcd =~ (?-i)^ABC ==> 0\n"
" /eval -n -c abcd =~ (?-i)^abc ==> 1\n"
" /eval -n -c abcd !~ abc ==> 0\n"
" /eval -n -c abcd =* a*d ==> 1"),
" /eval -n -c abcd =* a*d ==> 1\n"
" /eval -n -c abcd =- bc ==> 1"),
"-n|-s|-c -n|-s|-c",
&command_eval, NULL, NULL);
hook_command (