Stevo
Stevo

Reputation: 11

Regular Expression Exact match numbers characters digits special characters

i am looking for a regular expression to have EXACT 8 ocurrences, these occurences may be characters, numbers, special characters,etc..

I thought about this regex: .{8} But this allows you to enter more and is not an exact match,

Who could help me? Greetings

Upvotes: 1

Views: 3237

Answers (1)

Casimir et Hippolyte
Casimir et Hippolyte

Reputation: 89557

You must add anchors to have an exact match:

^.{8}$


^   #begin of the string
$   #end of the string

Upvotes: 3

Related Questions