http://qs321.pair.com?node_id=944305


in reply to Re^3: regex to find vowels in anyorder
in thread regex to find vowels in anyorder

If the first is not found, you're done, per OP's spec: "all 5 vowels"

Replies are listed 'Best First'.
Re^5: regex to find vowels in anyorder
by JavaFan (Canon) on Dec 20, 2011 at 01:28 UTC
    You also asked (in a message, but the answer is way to lengthy for the peephole messages force you to use):
    Perhaps I fail to understand your question. My comment predicated on the fact that if a vowel is absent, continuation is moot. Not so?
    Let me explain the sequence of events:
    1. varghees asks the original question how to write a regexp matching all five vowels.
    2. SuicideJunkie gives the obvious answer, the "anded if".
    3. leuchuk replies to SuicideJunkie, saying he wouldn't use the "anded if" solution, but an array based on because As soon as the script has found the first vowel the script would continue with the next vowel but if the vowel wasn't found it would stop the whole search as it's not interesting whether the other vowels are in the string.
    4. I ask leuchuk why he'd choose that solution over the "anded if", as the "anded if" also gives that benefit (you, know, short-circuiting logic operators) -- but leuchuk seems to suggest that it doesn't.
    5. You reply to me with If the first is not found, you're done, per OP's spec: "all 5 vowels". Noone in this sequence of posts leading up to yours has giving even the most remote inkling that he was thinking it was about anything else but matching all 5 vowels.
    So, let me repeat my question, how does your reply to me answer the question why doesn't an "anded if" stop if a vowel isn't found? It's not that what you say is wrong, it's just that you're stating something irrelevant as it doesn't even try to answer the question.
      Ah-ha! The light comes on...
      but I still think one of us is mis-reading the node in question -- either by reading something into it (you) or failing to see a blind spot in leuchuk's understanding of short-circuiting (me).

      Quoting what seem to me to be the relevant lines:

      "As soon as the script has found the first vowel the script would continue with the next vowel but if the vowel wasn't found it would stop the whole search as it's not interesting whether the other vowels are in the string."
      1. Thru "the next vowel" is irrelevant to our disagreement.
      2. beginning with "but if..." thru "the whole search" - while your supposition about leuchuk's understanding of the operation of "and-ed ifs" may be accurate, I don't see any strong reason for that supposition. Consider, if you will, this pseudocode paraphrase of the the "but if ...the whole search" component of that clause:
        if (some vowel ! found ) { exit; }

      The end of that sentence, "as it's not interesting whether the other vowels are in the string", seems to me to be no more or less than a second restatement of OP's spec -- all five vowels -- attributed by leuchuk at this point to "the script" he's talking about.

      I hate to invoke a pro sports rule, but it seems to fit here: if the instant replay fails to show incontrovertible evidence that the call on the field was wrong, the call stands. Stretching the parallel almost to the breaking point, I think you've superimposed a supposition -- possible but unproven, to me -- over the replay.

Re^5: regex to find vowels in anyorder
by JavaFan (Canon) on Dec 19, 2011 at 23:31 UTC
    If the first is not found, you're done, per OP's spec: "all 5 vowels"
    How does that answer my question?