in reply to Re: Preferred Methods (again)
in thread Preferred Methods (again)
"(\S+?)" is a broken way to capture an attribute. (Hint: what happens if an attribute contains whitespace chars?) Consider using "([^"]+)" instead. Even better, consider profiling to make sure that using a proper XML-parsing module (whose author has already gone looking for this sort of bug) is enough of a slow-down to merit going to hard regex-based chunking.
Update: Yeah, if you care about empty attributes (debatable; I usually don't), "([^"]*)" is the way to go. Thanks Matts!
--
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: (FoxUni) Re(2): Preferred Methods (again)
by Matts (Deacon) on Jan 17, 2002 at 17:10 UTC |