How to make a regex pattern that matches a character only when there’s another one? Just wondering.
Another one or at least one more?
Only when there’s another, different character.
Definition of your question has a lot of outcomes:
- Do you want to match only one character or whole string only if there are 2+ characters?
- What are you considering to be a character? Whitespace is a character also
- If you want to match only one character, is it specific character or any character (would always be first one in the case of 2+ characters)
It might be that when you define your question precisely you will come up with the answer yourself.