IF ELSE sentences in REGEX?

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
Sturla
Posts: 1
Joined: Sun Feb 05, 2023 4:22 pm

IF ELSE sentences in REGEX?

Post by Sturla »

Hi,
I want to create a SQL smart group listing all references where the surname of first author starts with eg. the letter A. And, *if* the field Authors is empty(NULL), the field Editors or Ser Editors should be matched instead. I'm a regex newbie, and haven't found a solution for if-then-else sentences that work in regex.

I tried this, but got an error:
(?(?=authors IS NULL) editors REGEX '^[Aa][^\n]*'|authors REGEX '^[Aa][^\n]*')

Solution so far:
authors REGEX '^(?i)A[^\n]*'
OR editors REGEX '^(?i)A[^\n]*'

but this matches both. Suggestions will be greatly appreciated.

Thanks,
Sturla
Post Reply