Page 1 of 1

REGEX search doesn't cover all references

Posted: Wed Feb 17, 2021 2:29 am
by cawright
Hi

I have 3660 references in "All"
I annotate them with "exclude" as the first word in the keywords field if they are not relevant to my current project

This search:
keywords REGEX '\Aexcluded' OR NOT keywords REGEX '\Aexcluded'

returns 3545 references (so 115 are not being captured). So I clearly don't understand something about how the search works. I thought that pair of regex queries would necessarily cover all records. Either 'excluded' starts ('\A') the keyword field, or it doesn't.

Help gratefully received

Cheers

Re: REGEX search doesn't cover all references

Posted: Wed Feb 17, 2021 3:43 am
by cawright
Answering your own question is regarded as bad form in some fora, so apologies that's the case here:

A search to find those not covered by the search in the first post:

NOT (keywords REGEX '\Aexcluded' OR NOT keywords REGEX '\Aexcluded')

And all of them have empty keywords field. And that's clearly not covered by NOT keywords REGEX '\Aexcluded'.
I thought it would be...

python - regex search of empty string

>>> x = re.search('a', "")
>>> x
>>> x == None
True
>>> if x:
... print("found")
... else:
... print("not found")
...
not found

What would be a search that would find an empty keywords field?

keywords REGEX ''

doesn't find any records.

Re: REGEX search doesn't cover all references

Posted: Wed Feb 17, 2021 9:16 am
by Jon
keywords is NULL

This is covered on p.349 of the User Guide (Help menu).

Jon
Sonny Software

P.S. There is also a UI option for finding empty fields in both Find and smart searches.

Re: REGEX search doesn't cover all references

Posted: Wed Feb 17, 2021 6:54 pm
by cawright
Ahh, yep. Thanks
Apologies for not RTFM