Can there be a Regex : "First two character should not be same in a string" -
can there such regex?
first 2 characters should not same in string.
for engines supporting look-ahead (which case in languages), can use this:
^(.)(?!\1)
it captures first character , checks next character not same character, negative look-ahead , backreference \1
.
though juhana stated in comment, should consider using normal string operations check, unless regex option available.
Comments
Post a Comment