Page 1 of 1

IF ELSE sentences in REGEX?

Posted: Tue Feb 07, 2023 6:19 am
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