Pattern For Diffrent Input

<!--------for password----------->
<form action="/action_page.php">
Password: <input type="password" name="pw" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters">
<input type="submit">
</form>


^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$

<!-----------for charactr------------------>
<form action="/action_page.php">
  Country code: <input type="text" name="country_code" pattern="[A-Za-z]{3}" title="Three letter country code">
  <input type="submit">
</form>

3 is the length


<!------------------for email--------------->
<p>A form with an email field that that must be in the following order: characters@characters.domain (characters followed by an @ sign, followed by more characters, and then a ".". After the "." sign, you can only write 2 to 3 letters from a to z:</p>
<form action="/action_page.php">
  E-mail: <input type="email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$">
  <input type="submit">
</form>

<input type="email" class="form-control" id="email" name="email" required="" placeholder="Enter Email eg.email@gmail.com"  onkeyup="checkAvailability1()" pattern="^(([-\w\d]+)(\.[-\w\d]+)*@([-\w\d]+)(\.[-\w\d]+)*(\.([a-zA-Z]{2,5}|[\d]{1,3})){1,2})$" >


<!---------------------------Mobile No----------------------------------------->
<input type="text" class="form-control validate[required,custom[phone]] text-input" pattern="[789][0-9]{9}" name="att_user_mobileno" placeholder="User Mobile No" maxlength="10"  >

<input type="text" class="form-control" id="mobile" name="mobile" maxlength="10" pattern="[789]{1}[0-9]{9}" required="" placeholder="Enter Mobile No." oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1');">

<!--------------------------Letters-------------------------->
pattern="[A-Za-z]+" accepts only capital or small letters.
<form><input type="text" pattern="[A-Za-z]+" title="letters only" required /><input type="submit" /></form>

<input type="text" placeholder="Enter Name" class="form-control" id="name" name="name" required="" oninput="this.value = this.value.replace(/[^a-zA-Z\s.]/g, '').replace(/(\..*)\./g, '$1');">



<!-------------------Numbers---------------------->

pattern="[0-9]+" accepts only numbers 0, 1, 2....

<form><input type="text" pattern="[0-9]+" title="only letters" required /><input type="submit" /></form>



<!--------------------------------Email--------------------------------->
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" accepts valid email address
<form><input type="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" title="xyz@something.com" required /><input type="submit" /></form>



<!----------------------------Password------------------------------------------>
pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" accepts one number one upper and lower case letters with 8 or more chars.
<form><input type="password" name="pass" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="at least one number and one uppercase and lowercase letter, and at least 8 or more characters" required /><input type="submit" /></form>



<!----------------------------URL------------------------------->pattern="https?://.+" required title="http://cleartuts.blogspot.com" accepts valid web url starting with http://.
<form><input type="url" name="website" pattern="https?://.+" required title="http://cleartuts.blogspot.com" /><input type="submit" /></form>



<!------------------------------Phone No------------------------->pattern="^\d{10}$" accepts only numeric values with 10 digit.
<form><input type="tel" pattern="^\d{10}$" title="10 numeric characters only" required /><input type="submit" /></form>

<!----------------------------Alpha Numeric--------------------------------->pattern="^[a-zA-Z][a-zA-Z0-9-_\.]{5,12}$" accepts alphanumeric values letters and digits.
<form><input type="text" pattern="^[a-zA-Z][a-zA-Z0-9-_\.]{5,12}$" title="alphanumeric 6 to 12 chars" /><input type="submit" /></form>

<!-----------------------------Full Script---------------------------------->

<form method="post"><pre><div><label>Name : (letters only)*</label><input type="text" pattern="[A-Za-z]+" title="only letters" required /></div> <div><label>E-mail : (xyz@zyx.com)*</label><input type="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" title="xyz@something.com" required /></div> <div><label>website : (http://cleartuts.blogspot.com)*</label><input type="url" pattern="https?://.+" title="http://cleartuts.blogspot.com" required /></div> <div><label>pin code : (numbers only)</label><input type="text" pattern="[0-9]+" title="numbers only" required /></div> <div><label>password : (at least 6 chars)</label><input type="password" pattern=".{6,}" title="Six or more characters" required /></div> <div><label>phone no : (10 chars)</label><input type="tel" pattern="^\d{10}$" title="10 numeric characters only" required /></div> <input type="submit">

Previous
Next Post »

ConversionConversion EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng