I currently have the following regular expression:
([1-6](\\s|,)*){1,6}
This will accept : a number from 1 to 6, followed by any number of spaces or commas, anywhere from 1 - 6 times.
You can find some examples below :
- 1,4 , 2,
- 3, 3, 3, 3
This regular expression alone does not disqualify all invalid inputs, as integers should not be allowed to reoccur. I know that this is possible to achieve through regex syntax alone, however I am not able to make an educated decision on whether or not I want to just use conditional statements instead. I am curious about how the two techniques compare in the following areas:
- compile time / method overhead
- run time / memory management efficiency
- readability (your personal opinion please)
- ease of use (your personal opinion please)
Aucun commentaire:
Enregistrer un commentaire