From: Eirik Meland Date: 2002-02-03T23:56:28+09:00 Subject: Re: group substitution doesn't work in character classes? Harry Ohlsen writes: > In article , "Thom Harp" > wrote: > > > I'm trying to remove quoted substrings from a string. The substrings > > may be quoted with single or double quotes so I use the following > > regular expression which I thought would find the first quote character > > and remove everything up to the next occurance of that same character: > > > > /(['"])[^\1]*\1/ > > I know there's an example of matching comma-separated lists (which > include singly and doubly quoted strings) in the Mastering Regular > Expressions O'Reilly book. > > I recall that it was a very complex RE, so maybe this just isn't an easy > thing to do with the design of REs. > > That should help you a lot. Someone's bound to show you how to do it, > now. That's what always happens when I make rash statements :-). * is greedy to make * not greedy add a ? /(['"])[^\1]*?\1/ would do it, or? -- Eirik (eirikm@ifi.uio.no) (shortcut-junkie)