REGEX search doesn't cover all references

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
cawright
Posts: 8
Joined: Mon Jan 18, 2021 6:44 am

REGEX search doesn't cover all references

Post 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
cawright
Posts: 8
Joined: Mon Jan 18, 2021 6:44 am

Re: REGEX search doesn't cover all references

Post 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.
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: REGEX search doesn't cover all references

Post 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.
cawright
Posts: 8
Joined: Mon Jan 18, 2021 6:44 am

Re: REGEX search doesn't cover all references

Post by cawright »

Ahh, yep. Thanks
Apologies for not RTFM
Post Reply