Loading ...
Sorry, an error occurred while loading the content.

triple consonants

Expand Messages
  • Axel Berger
    I want to find triple consonants like fff through Regex. Instead of the obvious way I tried to be clever, which of course backfired. The term
    Message 1 of 9 , Feb 1, 2010
    • 0 Attachment
      I want to find triple consonants like fff through Regex. Instead of the
      obvious way I tried to be clever, which of course backfired. The term

      (f|l|m|n|p|r|t){3}

      finds three consonants in a row, even if they're different. Is there a
      clever alternative to

      (fff|lll|...)? The main reason I ask is not cleverness for its own sake
      but that I need a single found consonant in my replace string, i.e. for
      "fff" I need "f" and so on.

      Thanks
      Axel

      --
      Dipl.-Ing. F. Axel Berger Tel: +49/ 2174/ 7439 07
      Johann-Häck-Str. 14 Fax: +49/ 2174/ 7439 68
      D-51519 Odenthal-Heide eMail: Axel-Berger@...
      Deutschland (Germany) http://berger-odenthal.de
    • Axel Berger
      ... I ve found a solution that works: ^!Replace (?|(ff)f|(ll)l|(mm)m|(nn)n|(pp)p|(rr)r|(tt)t)([aeiouäöü]) $1$2 HRASTI But I d still be interested in
      Message 2 of 9 , Feb 1, 2010
      • 0 Attachment
        Axel Berger wrote:
        > I want to find triple consonants like fff through Regex.

        I've found a solution that works:

        ^!Replace "(?|(ff)f|(ll)l|(mm)m|(nn)n|(pp)p|(rr)r|(tt)t)([aeiouäöü])" >>
        ""$1$2" HRASTI

        But I'd still be interested in a more elegant one. For me elegance means
        legible and easy to understand. I usually prefer useing several
        ^!Replaces in a row rather than one very clever one, that would take me
        several minutes to understand when I want to change something months
        later.

        Thanks
        Axel
      • John Shotsky
        Axel, Does that really work? I ask because you said you wanted to replace triples with singles, but yours appears to capture doubles. There is one too-many
        Message 3 of 9 , Feb 1, 2010
        • 0 Attachment
          Axel,

          Does that really work? I ask because you said you wanted to replace triples with singles, but yours appears to capture
          doubles. There is one too-many double quotes too. Is there a requirement that a vowel follow the triple? What if a
          space, punctuation, line end or other consonant follows? How about other accented vowels, as in sauté? What if there are
          4 or 5 of the wanted consonants in succession?



          A slight modification:

          ^!Replace "(?|(f)ff|(l)ll|(m)mm|(n)nn|(p)pp|(r)rr|(t)tt)([aeiouäöü])" >> "$1$2" AIRSTW



          Before:

          This is a sentence with fffine mmmommas and slllight snnnails and rrreparations stttopping.

          After:

          This is a sentence with fine mommas and slight snails and reparations stopping.



          However, if there could be more than three matching consonants in a row, add pluses:

          ^!Replace "(?|(f)ff+|(l)ll+|(m)mm+|(n)nn+|(p)pp+|(r)rr+|(t)tt+)([aeiouäöü])" >> "$1$2" AHIRTSW

          Before:

          This is a sentence with fffffine mmmmmommas and slllllight snnnnnails and rrrrreparations stttttopping.

          After:

          This is a sentence with fine mommas and slight snails and reparations stopping.



          And finally, if it doesn’t really matter what follows the 3 or more target consonants, but you always want the triples
          or larger to be reduced to one:

          ^!Replace "(?|(f)ff+|(l)ll+|(m)mm+|(n)nn+|(p)pp+|(r)rr+|(t)tt+)" >> "$1" AHIRTSW

          Before: (Note the extra t’s in slight…)

          This is a sentence with fffffine mmmmmommas and slllllighttttt snnnnnails and rrrrreparations stttttopping.

          After:

          This is a sentence with fine mommas and slight snails and reparations stopping.



          Well, that was fun. Now for some coffee, so I can wake up… J

          Regards,

          John



          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Axel Berger
          Sent: Monday, February 01, 2010 2:13 AM
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] triple consonants





          Axel Berger wrote:
          > I want to find triple consonants like fff through Regex.

          I've found a solution that works:

          ^!Replace "(?|(ff)f|(ll)l|(mm)m|(nn)n|(pp)p|(rr)r|(tt)t)([aeiouäöü])" >>
          ""$1$2" HRASTI

          But I'd still be interested in a more elegant one. For me elegance means
          legible and easy to understand. I usually prefer useing several
          ^!Replaces in a row rather than one very clever one, that would take me
          several minutes to understand when I want to change something months
          later.

          Thanks
          Axel





          [Non-text portions of this message have been removed]
        • diodeom
          ... This seems to do the trick for me: ^!Replace ([flmnprt])( g1) g1 $1$2 WARIS
          Message 4 of 9 , Feb 1, 2010
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
            >
            > Axel Berger wrote:
            > > I want to find triple consonants like fff through Regex.
            >
            > I've found a solution that works:
            >
            > ^!Replace "(?|(ff)f|(ll)l|(mm)m|(nn)n|(pp)p|(rr)r|(tt)t)([aeiouäöü])" >>
            > ""$1$2" HRASTI
            >
            > But I'd still be interested in a more elegant one. For me elegance means
            > legible and easy to understand. I usually prefer useing several
            > ^!Replaces in a row rather than one very clever one, that would take me
            > several minutes to understand when I want to change something months
            > later.
            >
            > Thanks
            > Axel
            >

            This seems to do the trick for me:
            ^!Replace "([flmnprt])(\g1)\g1" >> "$1$2" WARIS
          • Don - HtmlFixIt.com
            Why not ... ^!Replace (?|(f)f+|(l)l+(m)m+|(n)n+|(p)p+|(r)r+|(t)t+)([aeiouäöü]) $1$2 AIRSTW Will that work? Finding two or more? Maybe some before or
            Message 5 of 9 , Feb 1, 2010
            • 0 Attachment
              Why not ...
              ^!Replace "(?|(f)f+|(l)l+(m)m+|(n)n+|(p)p+|(r)r+|(t)t+)([aeiouäöü])" >>
              "$1$2" AIRSTW
              Will that work? Finding two or more?

              Maybe some before or after samples would help us see what you are
              actually doing :-)

              John Shotsky wrote:
              > Axel,
              >
              > Does that really work? I ask because you said you wanted to replace triples with singles, but yours appears to capture
              > doubles. There is one too-many double quotes too. Is there a requirement that a vowel follow the triple? What if a
              > space, punctuation, line end or other consonant follows? How about other accented vowels, as in sauté? What if there are
              > 4 or 5 of the wanted consonants in succession?
              >
              >
              >
              > A slight modification:
              >
              > ^!Replace "(?|(f)ff|(l)ll|(m)mm|(n)nn|(p)pp|(r)rr|(t)tt)([aeiouäöü])" >> "$1$2" AIRSTW
            • Don - HtmlFixIt.com
              Can you break that down for us? g is ... something out of the prior group? So any time you have two of the prior in a row (will it however mix and match or
              Message 6 of 9 , Feb 1, 2010
              • 0 Attachment
                Can you break that down for us?
                \g is ... something out of the prior group?
                So any time you have two of the prior in a row (will it however mix and
                match or does \d insist on it being the SAME letter?

                As to figuring it out months later John, I alway leave a comment that
                explains what it does ...

                > This seems to do the trick for me:
                > ^!Replace "([flmnprt])(\g1)\g1" >> "$1$2" WARIS
              • Axel Berger
                ... Yes it does. I know I said I wanted to find just the single letter, but my first attempt would have inserted it twice. The extra double quote too was part
                Message 7 of 9 , Feb 1, 2010
                • 0 Attachment
                  John Shotsky wrote:
                  > Does that really work?

                  Yes it does. I know I said I wanted to find just the single letter, but
                  my first attempt would have inserted it twice. The extra double quote
                  too was part of the replace string to be written. The result is TeX
                  notation for hyphenation in traditional German spelling. Whenever three
                  identical consonants are follwed by a vowel in composite words, only two
                  are written, but the third is resurrected in hyphenation. Thus in bed
                  sheet "Bett" plus "Tuch" become Bettuch and are hypenated Bett-tuch.

                  > How about other accented vowels, as in sauté?
                  > What if there are 4 or 5 of the wanted consonants in succession?

                  Neither is possible in the spelling of German words.

                  Danke
                  Axel
                • Sheri
                  ... You could try something like this: ^!Replace (?i)(? (?![aeiou])( pL) 1{2}) $1 RAWS or to disallow mixed case triples: ^!Replace
                  Message 8 of 9 , Feb 1, 2010
                  • 0 Attachment
                    On 2/1/2010 4:03 AM, Axel Berger wrote:
                    > I want to find triple consonants like fff through Regex. Instead of the
                    > obvious way I tried to be clever, which of course backfired. The term
                    >
                    > (f|l|m|n|p|r|t){3}
                    >
                    > finds three consonants in a row, even if they're different. Is there a
                    > clever alternative to
                    >
                    > (fff|lll|...)? The main reason I ask is not cleverness for its own sake
                    > but that I need a single found consonant in my replace string, i.e. for
                    > "fff" I need "f" and so on.
                    >
                    > Thanks
                    > Axel
                    >
                    >

                    You could try something like this:

                    ^!Replace "(?i)(?>(?![aeiou])(\pL)\1{2})" >> "$1" RAWS

                    or to disallow mixed case triples:

                    ^!Replace "(?>(?![AEIOUaeiou])(\pL)\1{2})" >> "$1" RAWS

                    Regards,
                    Sheri
                  • Axel Berger
                    ... Thanks, that s it. I ve modified it slightly to come up with: ^!Replace (f|l|m|n|p|r|t) 1{2}([aeiouäöü]) $1$1$2 HRASTI Danke Axel
                    Message 9 of 9 , Feb 1, 2010
                    • 0 Attachment
                      diodeom wrote:
                      > This seems to do the trick for me:
                      > ^!Replace "([flmnprt])(\g1)\g1" >> "$1$2" WARIS

                      Thanks, that's it. I've modified it slightly to come up with:

                      ^!Replace "(f|l|m|n|p|r|t)\1{2}([aeiouäöü])" >> ""$1$1$2" HRASTI

                      Danke
                      Axel
                    Your message has been successfully submitted and would be delivered to recipients shortly.