Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
RE: Re: Regexp glitch while parsing record in CSVby greenhorn (Sexton) |
on Jul 17, 2000 at 10:10 UTC ( [id://22824]=note: print w/replies, xml ) | Need Help?? |
<kbd>> m#(?:[^,]*,\s*){3}(.*?)\s*,#</kbd>
This worked, thanks--and taught me a couple of things about regular expressions that I'd seen in several of the books but hadn't yet understood. Still perplexed by the failure of the other regexp. Even though<kbd> [^,]+ </kbd>does indeed include spaces, I'm perplexed by why the<kbd> \s* </kbd>preceding and following it fail to catch spaces when they exist in those locations in the string.<kbd> \s* </kbd>does catch them when it is used this way: <kbd>split /\s*,\s*/ , $_</kbd> Thanks again.
In Section
Seekers of Perl Wisdom
|
|