Amy Grinn <grinn....@gmail.com> writes:

>> I recommend the following:
>>
>> If the value starts from ", use Elisp's `read':
>>    |"# <<" ">>"
>>    (read (current-buffer)) ; => "# <<"
>>    otherwise, consider read until the first whitespace.
>>    |#<<; >>;
>>    (re-search-forward (rx (1+ (not whitespace))))
>>    #<<;|
>>
>> However, there may be edge cases like
>>
>> "<< >>"
>> "<< >>
>> << << >>
>> << "asd" >>
>
> I didn't implement this recommendation yet; I still think the regex is a
> more clear way of putting it, even without using a temporary buffer:
>
>     ;; If a pair of " is found separated by one or more
>     ;; characters, capture those characters as a group
>     (unless (eq i (string-match (rx (* space) ?\"
>                                     (group (+ (not ?\")))
>                                     ?\" (* space))
>                                 raw i))
>       ;; Otherwise, capture the next non-whitespace group of
>       ;; characters
>       (string-match (rx (* space) (group (* (not space))) (* space))
>                     raw i))
>
> Let me know what you think!
Consider cases like

"< \"" "\" >"

or

"< >"

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to