0

I am using ASP.net 4.5 with bootstrap. Below is the code I have to allow only certain characters. How can I change this to allow the characters a-zA-Z0-9_. /,&|()!- but not allow the user to put in http or www.

<input type="text" class="form-control" name="subject" id="subject" placeholder="Enter subject"
                                    data-bv-message="The subject is not valid."
                                    data-bv-notempty="true" data-bv-notempty-message="The subject is required and cannot be empty."
                                    data-bv-regexp="true" data-bv-regexp-regexp="^[a-zA-Z0-9_. /,&|()!-]+$" data-bv-regexp-message="The subject can only consist of alphabetical, number, dot and underscore."
                                    />
Etienne
  • 7,141
  • 42
  • 108
  • 160

1 Answers1

0

I would say you might have to add groups for the words you don't want to have in your input value.

((!|www)|(!|http))

You can also take a look at this answer to a similar question, there you should get enough input to fix your expression

Isparia
  • 682
  • 5
  • 20