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

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -

javascript - three.js lot of meshes optimization -