simple list question

I want to avoid any links that contain “xyz” or “rss” or “abc” and I want only those links which contain “pqr” (but those containing “pqr” must not contain “xyz”, “rss” or “abc”)

tell application "Safari" to set current_link to do JavaScript "document.links[" & i & "].href" in document 1
.....	
if current_link does not contain "xyz" and current_link does not contain "rss" and current_link does not contain "abc" and current_link contains "pqr" then

The above is not a complete script. It works but I want to avoid writing “does not contain” / “contain” and instead create a list like

property theexclusions : {"xyz", "rss", "abc"}
property theinclusions: {"pqr"}

and then do something like:

if theexclusions is not in current_link and theinclusions is in current link then....

Hi,

you can only filter full strings with lists, there is no easy way for partial strings.
A workaround could be


property theexclusions : {"xyz", "rss", "abc"}
property theinclusions : {"pqr"}


checkLink("http://myrssServer/pqr") --> false
checkLink("http://myServer/pqr") --> true

--> returns false if the link contains at least one of the exclusions 
--> returns true if the link doesn't contain any exclusion and contains at least one inclusion 
on checkLink(theLink)
	set includeFlag to false
	repeat with i in theexclusions
		if theLink contains contents of i then return false
	end repeat
	repeat with i in theinclusions
		if theLink contains contents of i then
			set includeFlag to true
			exit repeat
		end if
	end repeat
	return includeFlag
end checkLink