On Fri, Sep 25, 2009 at 12:07 AM, Christian Brabandt <[email protected]>wrote:
>
> On Fri, September 25, 2009 7:43 am, Jeremy Conlin wrote:
> > I know there are some regex wizards out there, I am in need of your help.
> > I have lines in my file that look like one of the following two
> >
> > Some text & more text & (some white space) & ...
> > Some text & more text & (some numbers, :, or -) & ...
> >
> > For the life of me I can't get my regular expression to differentiate
> > between the two. This is what I tried (but it found both lines):
> >
> > \_^\(.\{-}\s&.\{-}&\s*\)\(\s\{-}[\d:-]\{1,}\)
>
> You are at least missing the paranthesis in your pattern and I believe
> the \d form is not valid inside []. Using the following pattern
>
> ^\(.\{-}\s&.\{-}&\s*\)\((\s\{-}[0-9:-]\{1,})\)
>
> works, assuming you want to match the following line:
> Some text & more text & (12349:-) & ...
>
> regards,
> Christian
>
That didn't quite work and it's my fault for not giving better examples.
Here are two lines:
The genealogies & & 1:2--17 & & 3:23--38 & & \\
Elisabeth's seclusion & Judaea: Bethlehem & & & 1:24--25 & & \\
I want my regular expression to find the first line and not the second
because there is non-whitespace between the second and third ampersand.
What I'm trying to do is replace "1:2--17" with "\index{1:2--17}"
Is that example more clear?
Thanks,
Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---