Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

WARNING merlyn wrote BAD CODE

by Ovid (Cardinal)
on Jul 27, 2000 at 22:55 UTC ( #24729=note: print w/replies, xml ) Need Help??

in reply to RE: Death to Dot Star!
in thread Death to Dot Star!

Okay, the title is kind of a joke. It's just a good-natured tweak at merlyn for the brouhaha over his WARNING t0mas wrote BAD CODE node that generated so much flak. No offense intended :)

merlyn's code was bugging me, but I couldn't quite put my finger on it. My problem was that the dot metacharacter is so indiscriminating that it will match anything. However, I simply assumed that if merlyn posted the code, it must work. His code is great if you're checking for C-style comments that begin and end in something like /* comment here */ or "? comment here ?". But if you read my post, that's not what we were checking for:

    What happens if you were trying to extract questions in quotes without the trailing question mark?
I mentioned embedded question marks (my idea was that we might have more than one question in a quote), but I never mentioned embedded quotes. I just wanted one set of quotes and my original post bears that out. Here's merlyn's code and my correction:
#!/usr/bin/perl -w $myvar = q{ abc"def"g"hi?"jkl }; # This regex is from merlyn print "matched <$1>\n" if $myvar =~ /" # First quote ( # Capture text to $1 (?: # Non-backreferencing parentheses (?!\?") # not question quote? . # ok to inch along )* # Zero or more ) # End capture \?"/sx; # Followed by a question mark and quote # This regex is from Ovid print "matched <$1>\n" if $myvar =~ /" # First quote ( # Capture text to $1 (?: # Non-backreferencing parentheses [^?"] # Not a question mark or parentheses | # or \?(?!") # A question mark not followed by a quote )* # Zero or more ) # End Capture \?"/sx; # Followed by a question mark and quote
The first regex will print matched <def"g"hi>. The second will print matched <hi>.

No disrespect is intended towards Randal as he was right in pointing out that my first regex was broken.


Replies are listed 'Best First'.
RE: WARNING merlyn wrote BAD CODE
by merlyn (Sage) on Jul 27, 2000 at 22:58 UTC
      I misunderstood the goal, but I knew that yours wouldn't solve the goal. :)

      Typical Randal. Hey, Randal, have you ever thought about just acknowledging someone else's effort without taking a swipe at the bloke afterwards? I mean, really, how many times do we have to put up with you acting like the big dog and pretending that no one else has anything else to offer?

      I've read through some of your posts here and I have never seen you compliment anyone. On this one, you could have just admitted you were wrong and complimentd "ovid" on his code, or just admitted that you were wrong. Period. No, your ego wouldn't allow that. You had to cut him down.

      If you even remotely care about why you have problems with people, perhaps you should wonder why you cannot be bothered to acknowledge anyone. You know why the witch hunt at Intel and your felony conviction happened? It is not because you were wrong. It looks like you were trying to act in the company's best interest. It's because you are so arrogant that people want to take you down a peg.

      Try admitting that someone besides Randal has something worthwhile to contribute.

      Oh, and that boycott thing is typical Randal BS. Grow up.

        I'll say we have two possibilities here: You're right or you are wrong.

        If you're wrong, knock it off.

        If you're right, this is not an appropriate place for attacks like this. I for one would prefer to see this be a place where people can freely exchange ideas without vicious flames like this. Please, take this elsewhere.


        To further Ovid's statement, if you want to be taken seriously use your name. Give merlyn the courtesy of knowing his attacker and being able to respond correctly.

        Otherwise, please find another venue for your attacks. I might suggest either here or /dev/null.

        Thank you,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://24729]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2017-03-30 15:24 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (360 votes). Check out past polls.