RegEx: Match Non-Escaped Double Quoted Strings?

Don’t try to parse an irregular language like Ruby with regular expressions. Try to find a proper parser for Ruby instead that returns an array of the used language tokens.

Modern patterns are not the primitive things restricted to regular languages as taught in finite automata courses. I'm not saying that you should use patterns for everything like this, mind you; grabbing the tokenizer’s output is obviously a much better approach. But the limitations of computability as taught in automata courses have virtually no relevance to modern patterns, which have backreferences, conditionals, recursion, and much more.

– tchrist Nov 7 '10 at 14:53 @tchrist: Using regular expressions for irregular languages might work with nowadays regular expression implementations. But it is far more complex, error prone, and probably inefficient than using a parser. – Gumbo Nov 7 '10 at 14:58 With the proviso that this answer is intended as an example of why using regular expressions instead of parsers may be a bad idea, I’m not sure that that is inherently more complex, error prone, or inefficient than a parser.

In fact, it is a parser, wouldn’t you agree? – tchrist Nov 7 '10 at 15:06.

What Gumbo said. You cannot make this work correctly with regular expressions alone. But you might try this: preg_match("/'(^'\n\\|\\'|\\^')+'/", ... Or maybe you have better luck with an assertion (?\\) right before the quote.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions