I am trying to write a regular expression that will be used on a text box to validate its contents to see if it is between 1 and 35. The characters within the text box can be an
Like this: .
The . means any character except newline (which sometimes is but often isn't included, check your regex flavour).
You can rewrite your expression as ^.{1,35}$, which should match any line of length 1-35.
If you want to set Min 1 count and no Max length,
^.{1,}$
If you also want to match newlines, then you might want to use "^[\s\S]{1,35}$" (depending on the regex engine). Otherwise, as others have said, you should used "^.{1,35}$"
Yes, . (dot) would match any character. Use:
^.{1,35}$
It's usually the metacharacter . when not inside a character class.
So use ^.{1,35}$. However, dot does not include newlines unless the dot-all modifier is applied against it.
You can use ^[\S\s]{1,35}$ without any modifiers, and this includes newlines as well.