[Top][All Lists]

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

string searching and saving results to a variable

From: ken
Subject: string searching and saving results to a variable
Date: Tue, 15 Feb 2011 18:15:13 -0500
User-agent: Thunderbird (X11/20101213)

It's time again to write an elisp function!!

One thing it needs to do a couple of times is save a string to a
variable.  The string to save will be an html header, like:

<h3>Section 4</h3>

but it could be multiple lines like this

<h3 class="newest-chapter-section-type" align="center">On
the origins of elisp confusion</h3>

It could even be three or four lines long.  Also, the line(s) could be
indented and so have unwanted white space in the first several columns.

Assuming the point is somewhere on that line or one of those lines, we do:

(end-of-line)    ; to preclude the point being at the far left.
; find the start of the string:
(re-search-backward "<h1\\|<h2\\|<h3\\|<h4\\|<h5" nil t)
;;somehow mark this as the beginning of the string???

;find the endpoint of the string:
(re-search-forward "</h1>\\|</h2>\\|</h3>\\|</h4>\\|</h5>" nil t)

;;save string to a variable to do other things with... how???

Thanks for any help.

reply via email to

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