Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


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

[Javascript] regexp - how to exclude a substring?


  • From: shawn.milo at gmail.com (Shawn Milo)
  • Subject: [Javascript] regexp - how to exclude a substring?
  • Date: Mon May 23 13:24:40 2005

> Maybe you can answer a more general question I have about regular
> expressions: why, when you search for
>          <div.*<\/div
> does regexp return a string that stretches all the way to the last </div
> found and not simply to the first one it encounters?

Easy: It's called "greedy matching," and every regex engine does it.

That's where I thought maybe something like a lookahead or lookbehind
might come in handy, because you can say something like:

<div, then a </div, without another </div before it

As for your other comments, I'll re-read and see if a thought is born.

Shawn



> 
> Warm regards,
> 
> Paul
> 
> 
> 
> At 09:18 AM 5/23/2005, Shawn Milo wrote:
> >Paul,
> >
> >I believe I have something that fulfills the requirements, although it
> >seems to freeze
> >my browser when I let it go through too many iterations.
> >
> >Take a look, and let me know what you think. I think there's a
> >fundemental flaw somewhere, but I think we can find it as a group.
> >
> >Everyone who takes the time to look at it: Feedback please! I know
> >there's some good stuff and some boo-boos in there, but I need help in
> >telling the one from the other.  ;o)
> >
> >Shawn
> >
> >
> >
> >
> >_______________________________________________
> >Javascript mailing list
> >Javascript@xxxxxxxxxx
> >https://lists.LaTech.edu/mailman/listinfo/javascript
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 


-- 
Voicemail any time at:
206-666-MILO