in reply to Regex: matching character which happens exactly once

Here you go, this passes all of my test cases:

/^(?(?=((?(3)(?(?!.*\3)(?(?!((?<=(?!\3).(?=(?2)). |(?=\3)..)))(*F))))(?(?=.)(?=(.)(?1)))))(*F))/sx

Simple!*

Replies are listed 'Best First'.
Re^2: Regex: matching character which happens exactly once (updated)
by haukex (Archbishop) on Oct 24, 2017 at 11:24 UTC
Re^2: Regex: matching character which happens exactly once
by LanX (Saint) on Nov 12, 2017 at 20:28 UTC
    Hauke

    I kept your replies on my growing to-do list but I'm realising now that I'm won't be able to "dive" into the matter again.

    Thanks for your help, I'm closing the case now.

    > Rolf, I blame you for the sleep I lost over this!

    And thanks for taking care of my insomnia. ;-p

    Honestly, while the use case is very exotic I learned a lot about the various corners of the regex features. I hope for you too!

    Der Weg war das Ziel! :)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!