
BigRich
Novice
Apr 26, 2001, 12:15 PM
Post #16 of 19
(7494 views)
|
jeff>That's not my regex at fault, BigRich; that's your understanding of the single-quoted string. Nothing wrong with my understanding of strings, single-quoted or not. As I read it, you stated that yours was the "intelligent" solution (so any other is un-intelligent?). I saw nothing that stated that the data had to be read in from a file or form submission or STDIN or flew in from LA or shaken gently before serving. jeff>Obviously, there's an error somewhere. What is it? jeff >The fact that the string you entered does not evaluate to what you think it does. I knew exactly what it would evaluate to, but that shouldn't matter to such an "intelligent" solution. jeff>Rather, it prints a,bc,"def \"\\" ghij",klmno. jeff>Do you see the missing backslash? Yep, but the two inner quotes are still escaped, surely an intelligent solution would figure out that the backslash between the escaped quotes was was just a backslash and wasn't supposed to escape the backslash that escaped the second inner quote. jeff>If, on the other hand, a USER entered the string on STDIN, jeff>Perl would not do the \\ -> \ translation, and my regex works fine. jeff>It was the data, not the process, that ran afoul. Ahhh, now I see, it's "intelligent" as long as the data plays fair, ok. That's fine, my solutions are both broken and I've never used them(my apologies to the op, but I never stated that they were the "intelligent" solution either). I've always used a regex based on the one in the FAQ (where 99% of the questions in these forums are already answered), but It's been a long time since I've had to work with a database in which I have no control over the delimiter and, after spending all night pounding out code, I didn't feel like digging through my junk drawer to find it so I used a method I saw in another forum recently. (funny, the self-proclaimed Perl gods in that group didn't appreciate it either) There's nothing wrong with the method I suggested (sure, it's ugly but so are most of the programmers I know and I don't hold that against them), it's my examples that could use some fine tuning and I think that I've shown that the data doesn't have to play fair for it to work. Don't mind me, Jeff. I'm the guy who stomps in the mud puddle to see how high the water will splash, sorry if I got your dockers dirty. BigRich
|