Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] regexp help: matching selectors
- From: shawn.milo at gmail.com (Shawn Milo)
- Subject: [Javascript] regexp help: matching selectors
- Date: Wed Jun 29 17:24:24 2005
No, not sure why this doesn't work. I wonder if the * only wants to find zero or more of a specific character, as in [a-z] or [0-9]. Would this be of any use to you? (untested) /^\s*html\s*[^#]*([a-zA-Z0-9_-])?(#[a-zA-Z0-9_-])?\s*$/ If you had a match on the middle section, you could grab that with a backreference and do a split to get the class names. Shawn On 6/29/05, Paul Novitski <paul@xxxxxxxxxxxxxxxxxxxx> wrote: > I'm developing regular expressions that will match CSS-style selectors. > > Here's my first stumbler: > > /html( \w+)* div/ > > (Intended to mean: the word "html" followed by zero-or-many instances of [a > space followed by one-or-many word characters] followed by a space and then > the word "div") > > I want this to match with: > > html div > html body div > html body div#logo > > etc. Can you explain to me why it's not working? > > Thanks, > Paul > > > _______________________________________________ > Javascript mailing list > Javascript@xxxxxxxxxx > https://lists.LaTech.edu/mailman/listinfo/javascript > -- Shawn Milochik The Freelance Pen FreelancePen.com 610-621-2648
- References:
- [Javascript] regexp help: matching selectors
- From: Paul Novitski
- [Javascript] regexp help: matching selectors
- Prev by Date: [Javascript] regexp help: matching selectors
- Next by Date: [Javascript] regexp help: matching selectors
- Previous by thread: [Javascript] regexp help: matching selectors
- Next by thread: [Javascript] regexp help: matching selectors
- Index(es):