emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with a regexp


From: Jean-Christophe Helary
Subject: Re: help with a regexp
Date: Thu, 15 Jul 2021 15:04:54 +0900


> On Jul 15, 2021, at 13:41, Timothy <tecosaur@gmail.com> wrote:
> 
> 
> Hi John,
> 
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
> 
>> 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?
> 
> I'd think so. Let me know if https://regex101.com/r/Ud6HVY/1 helps :)

cite:[^@][A-Za-z0-9_-]+|\[\[cite:[^@][A-Za-z0-9_-]+\]\]

There are no reasons to limit the string after : to ascii.

in isearch I tried:

\[\{2\}cite.*\]\{2\}\|[^\[]cite:[^ \
]*

And it seems to do the job.



-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]