[CLUE-Talk] Multiline Regex

William bkimball1 at yahoo.com
Fri Jul 2 12:35:56 MDT 2004


Not sure what your regexp background is, but I'll toss a couple hints out (based on some common
mistakes):

$  matches the end of a line
.  matches any character EXCEPT the end-of-line

Additionally, not all regexp processors support multi-line operations.  No matter how much you try
to force them to match beyond the end-of-line, the processor itself only compares your regexp
against one line at a time as fed from the source.  You'll have to dig into the documentation of
your editors to determine whether each supports multi-line operations.


--- Timothy Klein <teece at silverklein.net> wrote:
> Hey,
> 
> I am LaTeX-ifying a large text file (430 pages in the PDF/DVI).  It has a 
> glossary that makes up the bulk of these pages.
> 
> It is using the convention of _example_ to signal the meaning of old English 
> words in each entry.  So I want to find all these underscore pairs and change
> them to \textit{example}.  It would be super easy if all of them were only a 
> line or less.  But a lot of them span multiple lines, like _a longer
> multiline example_.
> 
> I kludged VIM in to giving me a multiline regex to sourround the glossary 
> headwords into paragraph sectioning, but I am having no luck with this one.
> 
> Anyone have any ideas?
> 
> I found a sed script on the web to do something similar to this, but I know 
> nothing about sed, so can't implement it without a lot of new learning.  Perl 
> can probably do it, but then I'd have to remember Perl.  Is there a way to 
> make VIM do mulitilne regex?  I haven't found much on Google.
> 
> Tim
> -- 
> == Timothy Klein || teece at silverklein.net
> == Vanity Page: http://tinyurl.com/vkhp
> == ----------------------------------------
> == Hello_World.c: 17 Errors, 31 Warnings...
> _______________________________________________
> CLUE-Talk mailing list
> Post messages to: CLUE-Talk at clue.denver.co.us
> Unsubscribe or manage your options: http://clue.denver.co.us/mailman/listinfo/clue-talk
> 


=====
William Kimball, Jr.
"Programming is an art form that fights back!"  =)


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 



More information about the clue-talk mailing list