Reputation: 5419
Trying to find a regex that matches to a String with only one type of character:
Example: "aaaaaa" or "a"
What expression would do this?
Upvotes: 1
Views: 1032
Reputation: 369444
Using capturing group and backreference:
/^(.)\1*$/
According to the regular expression engine you're using you may need to replace \1
with $
.
Upvotes: 2