0

Using Cforms and adding some validation in, thought i'd throw in the Honeypot method as well. With cforms it allows you to add a Regex into a field, but I have been trying to figure out how to create a "blank" regex.

the best I have so far is to put a space into the field then use this regex: ^\s This works perfectly well, but just out of pure interest, is there a pure blank version, so that if ANY character is typed in then it won't validate.

Thanks

marcv
  • 1,874
  • 4
  • 24
  • 45
Damian Smith
  • 85
  • 1
  • 2
  • 12
  • 1
    [this](http://stackoverflow.com/questions/5063977/regex-empty-string-or-email/5063991#5063991) may help – Jamie Taylor Jul 26 '13 at 09:31
  • Same method as posted below, but for some reason it won't validate if left blank! Looks like I will just stick to the space method :) – Damian Smith Jul 26 '13 at 09:37

2 Answers2

3

Like this? ^$ (start+end with nothing in between).

Prinzhorn
  • 22,120
  • 7
  • 61
  • 65
1

Just to add another way of doing the same thing: .{0}

marcv
  • 1,874
  • 4
  • 24
  • 45