View Single Post
Old 03-31-2021, 04:47 PM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,475
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
In my case, I was doing this:

Code:
&& publisher == '(Archive of Our Own|FanFiction.net)'
"that doesn't work, i'll try an in instead," so:

Code:
&& publisher in '(Archive of Our Own|FanFiction.net)'
"that gets the right result but looks strange, will it work the other way?"

Code:
&& '(Archive of Our Own|FanFiction.net)' in publisher
The "other way" is the right one. A regexp pattern works only if it is the left-hand argument. The "second way" might work but only by accident.

It seems like you are checking if some string matches some item in a list. In that case you probably should use list_contains() instead of 'in'. Something like:
Code:
list_contains($publisher, ',', '^(Archive of Our Own|FanFiction.net)$', 1, '')
I will look at whether a "in_list" operator makes sense given everything else that is going on inside the interpreter.
chaley is offline   Reply With Quote