in reply to validating a quoted string
How does your regular expression fail?
A first step would be to explain the regular expression and tell us in English words what ([.]?) is supposed to do.
Ideally, describe in English what the complete regular expression should do.
My approach to solving the problem would be to take all parts of a string between double quotes and check each part that it doesn't contain a space. Alternatively, look at all "words" that are delimited with whitespace, and check that they either contain no double quotes or start with a double quote and end with a double quote.
Update: I misread part of the problem:
my "dog shepherd" <-- valid
So that would imply that simply checking for an even number of double quotes is the simplest part.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: validating a quoted string
by hellosarathy (Novice) on Jan 13, 2016 at 13:49 UTC | |
|
Re^2: validating a quoted string
by hellosarathy (Novice) on Jan 13, 2016 at 13:51 UTC | |
by Corion (Patriarch) on Jan 13, 2016 at 13:57 UTC | |
by BillKSmith (Monsignor) on Jan 13, 2016 at 14:41 UTC |