[Solved] Regular express begin with “a” end with “b”, and can not exist a or b between


You can try something like

a[^ab]*b
  • [^ab]* matches anything other than a or b zero or more times

Regex Demo

2

solved Regular express begin with “a” end with “b”, and can not exist a or b between