Manish Prajapati
Manish Prajapati

Reputation: 1641

Cakephp Website URL input validation

I tried some regular expressions for website URL validation that only accept URLs starting with www. (not http:// or https://), but none fit my needs.

I tried : (?<!:\/\/)www\..+\.[a-z]{2,3} but that accepts URLs with other characters before www., like adswww.website.com. I only want to accept URLs that start with www..

cakephp v : 2.6

Upvotes: 0

Views: 547

Answers (2)

iam
iam

Reputation: 1013

You can resolve your problem by using

/^www\..+\.[a-z]{2,3}/

Upvotes: 1

m.cekiera
m.cekiera

Reputation: 5395

You can try for example with:

(?<!:\/\/)www\..+\.[a-z]{2,3}

Upvotes: 1

Related Questions