preg_match validate

preg_match validate

what is preg_match and how can i use it to validate the input field.

View Answers

October 19, 2010 at 12:50 PM

Hi,

in preg_match you can define any pattern for matching the user input.

And then use the preg_match method find the number of matches in it.

<?
$pattern = "";// Write regular expression here
$string = ""; //Variable to hold user input
//use preg_match to find no of matched
$count = preg_match($pattern, $string); 
print $count; //based on the count value you can validate the input
?>

Thanks









Related Tutorials/Questions & Answers:
preg_match validate
preg_match validate  what is preg_match and how can i use it to validate the input field.   Hi, in preg_match you can define any pattern for matching the user input.ADS_TO_REPLACE_1 And then use the preg_match method
Validate
Validate   hi all..im a beginner java and i need some help from u guys.. Its about validate. My HR request BF = 'brought forward', leave cannot apply date greater than 31/03 of particular year. So, if the user apply the date
Advertisements
long validate
long validate  How to validate long type
JavaScript regex validate validate Zip.
JavaScript regex validate validate Zip.  JavaScript regex validate - how to validate Zip?   <html> <head> <title>Zip Code...; function validate() { var zip = document.getElementById("zip").value
VALIDATE
validate() and reset() methods
validate() and reset() methods   Describe validate() and reset() methods
validate select option jquery
validate select option jquery  How to Validate select option in JQuery
reset() and Validate() method
reset() and Validate() method   How does reset() and Validate() method struts work
validate() method of ActionForm work
validate() method of ActionForm work  How does validate() method of ActionForm work
Validate telnet connectivity
Validate telnet connectivity  How to validate telnet connectivity in my java code
validate parameter before using it
validate parameter before using it   How to validate the parameter before using it in JSP
validate bank account number
validate bank account number  how to validate bank account number in jsp
validate bank account number
validate bank account number  how to validate bank account number in jsp
ModuleNotFoundError: No module named 'validate'
ModuleNotFoundError: No module named 'validate'  Hi, My Python... 'validate' How to remove the ModuleNotFoundError: No module named 'validate... to install padas library. You can install validate python with following
ModuleNotFoundError: No module named 'validate-it'
ModuleNotFoundError: No module named 'validate-it'  Hi, My Python... 'validate-it' How to remove the ModuleNotFoundError: No module named 'validate-it' error? Thanks   Hi, In your python environment
validate text field iPhone
validate text field iPhone  i got two different UITextfield in my iPhone application for user login. Just wondering how to validate
use of ActionMapping in validate()
use of ActionMapping in validate()  why do we pass actionmapping in validate(ActionMapping mapping,HttpServletRequest) even we don't use actionmapping in that method
Validate <select> tag Items
Validate select tag Items  Hi, How to validate addition of two numbers of two different "select" tag items in JavaScript..? Thanks in advance
Validate <select> tag Items
Validate select tag Items  Hi, How to validate addition of two numbers of two different "select" tag items in JavaScript..? Thanks in advance
validate input php
validate input php  How to validate the input fields in PHP & HTML.   Hi, Please let's know many fields is to be validated. Then I will make an example for you.ADS_TO_REPLACE_1 Thanks
javascript regex validate url
javascript regex validate url  How to validate URL in regex... regex</title> <script type="text/javascript"> function validate...; <input type="submit" value="Check" onclick="validate();" /> </body>
JavaScript regex validate Telephone no.
JavaScript regex validate Telephone no.  JavaScript regex validate...; function validate() { var phone = document.getElementById("phone").value...="phone" /> <input type="submit" value="Check" onclick="validate();" />
validate radio button using javascript
validate radio button using javascript  validate radio button using javascript
validation using validate method
validation using validate method  HOW TO DO THE VALIDATION IN THE STRUTS 2 USING VALIDATE METHOD IN ACTION CLASS,AND ALSO AM HAVING MY BEAN CLASS AS SEPERATE. I HAD TRIED THAT BUT IT WAS NOT WORKING PROPERLY. IF U KNOW
javascript regex validate currency
javascript regex validate currency  How to validate currency... validate() { var currency = document.getElementById("currency").value...="validate();" /> </body> </html> In general currency is in form
JavaScript regex validate Mobile no.
JavaScript regex validate Mobile no.  JavaScript regex validate... validate() { var mobile = document.getElementById("mobile").value...="mobile" id="mobile" /> <input type="submit" value="Check" onclick="validate
JavaScript regex validate Character
JavaScript regex validate Character  JavaScript regex validate... validate() { var name = document.getElementById("name").value; var...="submit" value="Check" onclick="validate();" /> </body> </html>
JavaScript regex validate Character
JavaScript regex validate Character  JavaScript regex validate... validate() { var name = document.getElementById("name").value; var...="submit" value="Check" onclick="validate();" /> </body> </html>
validate email objective c
validate email objective c  how can i validate email text field in objective c? is there any method that support multiple email address separated by coma.   - (BOOL)validateEmailWithString:(NSString*)email
JavaScript Validate UK Date
JavaScript Validate UK Date  How to Validate UK Date in JavaScript   <SCRIPT> function validateDate(dtControl) { var input = document.getElementById(dtControl) var validformat=/^\d{1,2}\/\d
Version of com.feiynn>feiynn-validate dependency
List of Version of com.feiynn>feiynn-validate dependency
ModuleNotFoundError: No module named 'datapackage-validate'
ModuleNotFoundError: No module named 'datapackage-validate'  Hi...: No module named 'datapackage-validate' How to remove the ModuleNotFoundError: No module named 'datapackage-validate' error? Thanks   Hi
ModuleNotFoundError: No module named 'edtf-validate'
ModuleNotFoundError: No module named 'edtf-validate'  Hi, My... 'edtf-validate' How to remove the ModuleNotFoundError: No module named 'edtf-validate' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'kubernetes-validate'
ModuleNotFoundError: No module named 'kubernetes-validate'  Hi, My... named 'kubernetes-validate' How to remove the ModuleNotFoundError: No module named 'kubernetes-validate' error? Thanks   Hi
ModuleNotFoundError: No module named 'pip-validate'
ModuleNotFoundError: No module named 'pip-validate'  Hi, My Python... 'pip-validate' How to remove the ModuleNotFoundError: No module named 'pip-validate' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pycard-validate'
ModuleNotFoundError: No module named 'pycard-validate'  Hi, My... named 'pycard-validate' How to remove the ModuleNotFoundError: No module named 'pycard-validate' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'python-validate'
ModuleNotFoundError: No module named 'python-validate'  Hi, My... named 'python-validate' How to remove the ModuleNotFoundError: No module named 'python-validate' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'py-validate'
ModuleNotFoundError: No module named 'py-validate'  Hi, My Python... 'py-validate' How to remove the ModuleNotFoundError: No module named 'py-validate' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'py-validate'
ModuleNotFoundError: No module named 'py-validate'  Hi, My Python... 'py-validate' How to remove the ModuleNotFoundError: No module named 'py-validate' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'scikit-validate'
ModuleNotFoundError: No module named 'scikit-validate'  Hi, My... named 'scikit-validate' How to remove the ModuleNotFoundError: No module named 'scikit-validate' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'ss-validate'
ModuleNotFoundError: No module named 'ss-validate'  Hi, My Python... 'ss-validate' How to remove the ModuleNotFoundError: No module named 'ss-validate' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'terraform_validate'
ModuleNotFoundError: No module named 'terraform_validate'  Hi, My... named 'terraform_validate' How to remove the ModuleNotFoundError: No module named 'terraform_validate' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'validate-yaml'
ModuleNotFoundError: No module named 'validate-yaml'  Hi, My... 'validate-yaml' How to remove the ModuleNotFoundError: No module named 'validate-yaml' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'validate-yml'
ModuleNotFoundError: No module named 'validate-yml'  Hi, My Python... 'validate-yml' How to remove the ModuleNotFoundError: No module named 'validate-yml' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'validate-docbr'
ModuleNotFoundError: No module named 'validate-docbr'  Hi, My... named 'validate-docbr' How to remove the ModuleNotFoundError: No module named 'validate-docbr' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'validate_email'
ModuleNotFoundError: No module named 'validate_email'  Hi, My... named 'validate_email' How to remove the ModuleNotFoundError: No module named 'validate_email' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'validate-parameters'
ModuleNotFoundError: No module named 'validate-parameters'  Hi, My... named 'validate-parameters' How to remove the ModuleNotFoundError: No module named 'validate-parameters' error? Thanks   Hi
ModuleNotFoundError: No module named 'validate-yaml'
ModuleNotFoundError: No module named 'validate-yaml'  Hi, My... 'validate-yaml' How to remove the ModuleNotFoundError: No module named 'validate-yaml' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'validate-yml'
ModuleNotFoundError: No module named 'validate-yml'  Hi, My Python... 'validate-yml' How to remove the ModuleNotFoundError: No module named 'validate-yml' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'zcfd-validate'
ModuleNotFoundError: No module named 'zcfd-validate'  Hi, My... 'zcfd-validate' How to remove the ModuleNotFoundError: No module named 'zcfd-validate' error? Thanks   Hi, In your python

Ads