How to create a regular expression for any string up to a maximum length?
Unsolved
General and Desktop
-
-
It should already work if you change the pattern to
"^.{0,32}$"
Test: https://regex101.com/r/PN7hSo/1
@raven-worx: I tried your pattern in the online tester but it did not match :(
-
@aha_1980
odd, seems like "^[]" has some special meaning?
It works when [] is replaced with () though -
@raven-worx said in How to create a regular expression for any string up to a maximum length?:
@aha_1980
odd, seems like "^[]" has some special meaning?Don't ask me - in theory it should work :)
It works when [] is replaced with () though
Yeah, that creates a capture group around '.' and is needed if you want to re-use the result. Otherwise you can just use '.'