• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Regex for recognizing strings consisting of unique characters

Resolved: Regex for recognizing strings consisting of unique characters

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

Could regular expression check if string consist of different letters in case of given string length and any string length ? Aahdj #wrong Gdhjd #wrong Sdfgh #correct Iophdr #correct

Answer:

For a given length it is possible. You’d make each captured character a capture group, and require that the captured character does not occur ahead. Let’s say the length is 4, then:
If the length is a dynamic input, then the regular expression has to be built dynamically, using some programming language. But the logic is simple.
For instance in JavaScript:

If you have better answer, please add a comment about this, thank you!

regex
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Is pandas groupby() function always produce a DataFrame with the same order respect to the column we group by?

24/03/2023

Resolved: Kivy widget hierarchy not behaving as expected

24/03/2023

Resolved: Pandas Groupby Get Values from Previous Group

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.