Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2014-10-08 11:52
Flavor·PCRE (Legacy)

/
\^([a-zA-Z0-9](?:(?:[a-zA-Z0-9-]\*|(?<!-)\.(?![-.]))\*[a-zA-Z0-9]\+)?)$
/
Open regex in editor

Description

I'm trying to match a hostname input with the following properties: a-z A-Z 0-9 : - are allowed ; doesnot start or end with - ; "." can be used to separate different labels of the hostname. But gives no match for this regex: ^(a-zA-Z0-9?)$
please help me.

Submitted by Revathy