View Single Post
Old 12-19-2021, 04:54 AM   #226
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,486
Karma: 8025704
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Code:
		if $rating ==# 0 && $#fanficstatus != '(In-Progress|Abandoned)' && $#vls !='Documentation & Manuals'  then
			'rating.png'
The In-Progress|Abandoned bit failed to work. How do I set "if it does not match this regex"?
The != operator is precisely that: case-sensitive not equals. It doesn't take a regex.

If you want to use a regex then you should use the 'in' operator. Because you want it negated, use
Code:
! ('^(In-Progress|Abandoned)$' in $#fanficstatus)
Alternatively use
Code:
($#fanficstatus != 'Abandoned' && $#fanficstatus != 'In-Progress')
or
Code:
! ($#fanficstatus == 'Abandoned' || $#fanficstatus == 'In-Progress')
To understand the difference between the above two expressions see a description of De Morgan's Law.
Quote:
Also, #vls should be an inlist. How do I set a "is not inlist"?

Use the '!' operator, e.g.,
Code:
! ('^Documentation & Manuals$' inlist $#vls)
The parentheses are there to avoid problems with operator precedence. You want to be sure that the '!' applies to the result of 'inlist' instead of 'Documentation & Manuals'. In fact the precedence of '!' is lower than the comparison operators (executes after them) but using parenthesis to state your intent is always a good idea.

I wonder if you shouldn't sign up to an Intro to Computer Science course.

Last edited by chaley; 12-20-2021 at 10:34 AM. Reason: Change 'not' to the operator !
chaley is offline   Reply With Quote