[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with a regexp
From: |
Stephen Berman |
Subject: |
Re: help with a regexp |
Date: |
Thu, 15 Jul 2021 10:46:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
On Thu, 15 Jul 2021 10:40:40 +0200 Stephen Berman <stephen.berman@gmx.net>
wrote:
> On Wed, 14 Jul 2021 20:43:24 -0400 John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>> Hi all, I could use a bit of help with a regexp. I am trying to fine tune
>> the org-ref citation regexp to
>> make it orthogonal to org-cite.
>>
>> I want to recognize these as org-ref links
>>
>> [[cite:schuett-2018-schnet]]
>> cite:schuett-2018-schnet
>>
>> but not
>>
>> [cite:@schuett-2018-schnet]
>>
>> so either 0 or 2 [[ can prefix it to be a cite link in org-ref, but not 1 [.
>>
>> right now the cite: in the org-cite syntax is getting flagged as bad cite
>> link which I want to avoid.
>>
>> is this doable?
>
> For your example this is sufficient (for real usage you probably want to
> add more context to the right of 'cite'):
>
> (re-search-forward "\\[\\[cite:\\|[^[]cite:")
Or simply:
(re-search-forward "\\[\\[\\|[^[]cite:")
Steve Berman