emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Inline markup: How does org identify nested code/verbatim?


From: c.buhtz
Subject: Re: Inline markup: How does org identify nested code/verbatim?
Date: Sun, 29 Jan 2023 18:20:03 +0000

Please let me add the nested-regex-approach. I wouldn't call this a
solution but just an approach. No one understand that regex it is
nearly unmaintainable.

I hope for a more elegant solution.

This matches if we have code in verbatim
^|[ .,;:\-?!({\"']=.*?(?:^|[ .,;:\-?!({\"']~.*?~[.,;:\-?!)}\"']|$).*?=[ 
.,;:\-?!)}\"']|$

This matches if we have verbatim in code
(?:^|[ .,;:\-?!({\"']~.*?(?:^|[ .,;:\-?!({\"']=.*?=[.,;:\-?!)}\"']|$).*?~[ 
.,;:\-?!)}\"']|$)

If one of this matching I now which one of my "usual" regex pattern using 
catching groups to extract the content I should use first.

Just for testing (maybe on regex101.com) here is the text I used.

This =is ~code~ in verbatim= text.
This =is usual verbatim= text.

This ~is =verbatim= in code~ text.
This ~is usual code~ text.



reply via email to

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