Community Patterns

Community Library Entry

0

Regular Expression
Created·2019-03-14 09:37
Flavor·ECMAScript (JavaScript)

/
^([a-zA-Z0-9]*-[a-zA-Z0-9]*){2}$
/
gm
Open regex in editor

Description

This should work:

^([a-zA-Z0-9]-[a-zA-Z0-9])+$ Also if you want to have exactly 135 hyphens:

^([a-zA-Z0-9]-[a-zA-Z0-9]){135}$ or if you want to have at least 23 hyphens but not more than 54 hyphens:

^([a-zA-Z0-9]-[a-zA-Z0-9]){23,54}$

Submitted by anonymous