I'm trying to exclude strings where the first char is equal to the third char:
passing strings: X9K3 V3Z5
not passing strings: A4A9 R5R1
I tried ^(.).[^\1].$
but I'm too new to regex to understand why it failed.
I'm trying to exclude strings where the first char is equal to the third char:
passing strings: X9K3 V3Z5
not passing strings: A4A9 R5R1
I tried ^(.).[^\1].$
but I'm too new to regex to understand why it failed.
 
    
    You may use this regex:
^(.).(?!\1).+$
[^\1] does not do what it intends to because inside [...] every character becomes literal after first ^ so it just matches everything except \ and 1.(?!\1) on the other hand is a negative lookahead which fails the match if character on next position is not same as what we captured in group #1.