help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: string searching and saving results to a variable


From: ken
Subject: Re: string searching and saving results to a variable
Date: Wed, 16 Feb 2011 11:58:53 -0500
User-agent: Thunderbird 2.0.0.24 (X11/20101213)

On 02/16/2011 04:21 AM Oleksandr Gavenko wrote:
> On 16.02.2011 8:55, ken wrote:
>> I'm guessing it could then be done more elispishly as
>>
>> (setq dog (buffer-substring
>>    (re-search-backward "<h1\\|<h2\\|<h3\\|<h4\\|<h5" nil t)
>>    (re-search-forward "</h1>\\|</h2>\\|</h3>\\|</h4>\\|</h5>" nil t)))
>>
> How about if search fail?
> 
> Evaluating of
> 
>   (buffer-substring nil nil)
> 
> take (wrong-type-argument integer-or-marker-p nil).

Error-checking is an excellent idea, I agree.  But I don't understand
the elisp code you wrote.  Could you explain it for me please.


Thanks.





reply via email to

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