Mastodon Skip to content
  • Home
  • Aktuell
  • Tags
  • Über dieses Forum
Einklappen
Grafik mit zwei überlappenden Sprechblasen, eine grün und eine lila.
Abspeckgeflüster – Forum für Menschen mit Gewicht(ung)

Kostenlos. Werbefrei. Menschlich. Dein Abnehmforum.

  1. Home
  2. Uncategorized
  3. Is there regex that matches an even number of occurrences of : in a single line

Is there regex that matches an even number of occurrences of : in a single line

Geplant Angeheftet Gesperrt Verschoben Uncategorized
9 Beiträge 2 Kommentatoren 0 Aufrufe
  • Älteste zuerst
  • Neuste zuerst
  • Meiste Stimmen
Antworten
  • In einem neuen Thema antworten
Anmelden zum Antworten
Dieses Thema wurde gelöscht. Nur Nutzer mit entsprechenden Rechten können es sehen.
  • schratze@todon.nlS This user is from outside of this forum
    schratze@todon.nlS This user is from outside of this forum
    schratze@todon.nl
    schrieb zuletzt editiert von
    #1

    Is there regex that matches an even number of occurrences of : in a single line

    Edit: elaborating on the exact problem. Here's what I'm trying to do:

    The closest match in terms of regex flavor is Golang

    schratze@todon.nlS natty@astolfo.socialN 2 Antworten Letzte Antwort
    1
    0
    • schratze@todon.nlS schratze@todon.nl

      Is there regex that matches an even number of occurrences of : in a single line

      Edit: elaborating on the exact problem. Here's what I'm trying to do:

      The closest match in terms of regex flavor is Golang

      schratze@todon.nlS This user is from outside of this forum
      schratze@todon.nlS This user is from outside of this forum
      schratze@todon.nl
      schrieb zuletzt editiert von
      #2

      I've been trying to find a solution for hours and I can't figure it out

      schratze@todon.nlS 1 Antwort Letzte Antwort
      0
      • schratze@todon.nlS schratze@todon.nl

        Is there regex that matches an even number of occurrences of : in a single line

        Edit: elaborating on the exact problem. Here's what I'm trying to do:

        The closest match in terms of regex flavor is Golang

        natty@astolfo.socialN This user is from outside of this forum
        natty@astolfo.socialN This user is from outside of this forum
        natty@astolfo.social
        schrieb zuletzt editiert von
        #3

        @schratze@todon.nl you mean (:.*?:)* ?

        natty@astolfo.socialN 1 Antwort Letzte Antwort
        0
        • natty@astolfo.socialN natty@astolfo.social

          @schratze@todon.nl you mean (:.*?:)* ?

          natty@astolfo.socialN This user is from outside of this forum
          natty@astolfo.socialN This user is from outside of this forum
          natty@astolfo.social
          schrieb zuletzt editiert von
          #4

          @schratze@todon.nl well with some stuff inbetween it'd be like ^((:.*?:)|[^:])*$ I think?

          schratze@todon.nlS 1 Antwort Letzte Antwort
          0
          • schratze@todon.nlS schratze@todon.nl

            I've been trying to find a solution for hours and I can't figure it out

            schratze@todon.nlS This user is from outside of this forum
            schratze@todon.nlS This user is from outside of this forum
            schratze@todon.nl
            schrieb zuletzt editiert von
            #5

            What exactly is being matched doesn't matter as long as the match is in the correct line. This is for a Vale rule. So all the info I'm trying to get is "there's something wrong with the syntax in this line, please double check and fix"

            1 Antwort Letzte Antwort
            0
            • natty@astolfo.socialN natty@astolfo.social

              @schratze@todon.nl well with some stuff inbetween it'd be like ^((:.*?:)|[^:])*$ I think?

              schratze@todon.nlS This user is from outside of this forum
              schratze@todon.nlS This user is from outside of this forum
              schratze@todon.nl
              schrieb zuletzt editiert von
              #6

              @natty thanks, but these match any line with at least two colons in it. I added some info to the OP

              natty@astolfo.socialN 1 Antwort Letzte Antwort
              0
              • schratze@todon.nlS schratze@todon.nl

                @natty thanks, but these match any line with at least two colons in it. I added some info to the OP

                natty@astolfo.socialN This user is from outside of this forum
                natty@astolfo.socialN This user is from outside of this forum
                natty@astolfo.social
                schrieb zuletzt editiert von
                #7

                @schratze@todon.nl hmm, I think this would be :.*?:([^:]*) /mg

                schratze@todon.nlS 1 Antwort Letzte Antwort
                0
                • natty@astolfo.socialN natty@astolfo.social

                  @schratze@todon.nl hmm, I think this would be :.*?:([^:]*) /mg

                  schratze@todon.nlS This user is from outside of this forum
                  schratze@todon.nlS This user is from outside of this forum
                  schratze@todon.nl
                  schrieb zuletzt editiert von
                  #8

                  @natty still the same issue

                  natty@astolfo.socialN 1 Antwort Letzte Antwort
                  0
                  • schratze@todon.nlS schratze@todon.nl

                    @natty still the same issue

                    natty@astolfo.socialN This user is from outside of this forum
                    natty@astolfo.socialN This user is from outside of this forum
                    natty@astolfo.social
                    schrieb zuletzt editiert von
                    #9

                    @schratze@todon.nl Right the line shouldn't match at all if the pairs don't add up

                    ^[^:]*:[^:]*?:([^:]*)$

                    1 Antwort Letzte Antwort
                    0
                    • necrosis@chaos.socialN necrosis@chaos.social shared this topic
                    Antworten
                    • In einem neuen Thema antworten
                    Anmelden zum Antworten
                    • Älteste zuerst
                    • Neuste zuerst
                    • Meiste Stimmen



                    Copyright (c) 2025 abSpecktrum (@abspecklog@fedimonster.de)

                    Erstellt mit Schlaflosigkeit, Kaffee, Brokkoli & ♥

                    Impressum | Datenschutzerklärung | Nutzungsbedingungen

                    • Anmelden

                    • Du hast noch kein Konto? Registrieren

                    • Anmelden oder registrieren, um zu suchen
                    • Erster Beitrag
                      Letzter Beitrag
                    0
                    • Home
                    • Aktuell
                    • Tags
                    • Über dieses Forum