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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -