Page 1 of 1

REGEX smart group help

Posted: Wed Aug 17, 2022 7:11 pm
by tarot sport
The idea seems simple but I cannot find a clear solution.
I would simply like to create a smart group that searches me for types of books and edited books that have attachments.
The first part is simple through standard rules, the second I guess through SQL but I can't seem to "put it all together." Thank you.

Re: REGEX smart group help

Posted: Thu Aug 18, 2022 7:41 am
by Jon
Bookends has some built-in SQL groups you can choose from when creating a new group, and some of these show you how deal with attachments.

This search would find all Books that have attachments:

"type"=2 AND attachments <> '' -- that's two straight apostrophes, not a double quote mark at the end.

This would find all Books and Edited Books that have attachments:

("type"=2 OR "type"=6) AND attachments <> ''

Paste these into the content field of a new SQL search.

Jon
Sonny Software

Re: REGEX smart group help

Posted: Thu Aug 18, 2022 7:45 am
by Jon
FYI, you may find this information in the user guide helpful:

Search for references that do or do not have attachments


To find references with attachments:

attachments <> ''

To find references without attachments:

attachments IS NULL

To find a reference with a specific attachment:

attachments REGEX '(?mi)my attachment name'

To find a reference with more than one attachment:

attachments REGEX '\n'


Jon
Sonny Software

Re: REGEX smart group help

Posted: Thu Aug 18, 2022 2:40 pm
by tarot sport
Thanks a lot. Also for the addition about the other language possibilities, which help me get into it.