75955Re: Matching JUST the nth occurence of a text in a line
- Dec 1, 2006On Fri, Dec 01, 2006 at 04:41:37PM -0500, Charles E Campbell Jr wrote:
> >>>I am puzzled by a slightly more complicated version:I can rephrase:
> >>> how to match a '%' character following the 2nd occurrence of "home"?
> >This pattern doesn't work. Try it on this line:
> >"home home home home home home% home"
> But it *does* work! You didn't specify avoiding the % if matches to the
> home pattern intervened.
"how to match a '%' character following the 2nd occurrence of "home"?"
"how to match a '%' character directly following the 2nd occurrence of "home"?"
I am pretty sure everyone else knew what I meant.
P.S. Does adding "directly" change the meaning for you? And if so, do
you know the regular expression I want?
> :set hls
> and the following two lines:
> home % home home home home home% home
> home home %home home home% home
> and you'll only see %s match after the 2nd home, exactly as specified.
> Now, if you change
> the requirement, a different regex is needed.
> Chip Campbell
- << Previous post in topic Next post in topic >>