| Casual Articles |
Hubs | Hubbers | Topics | Request |
| #1 in Business | Subscribe Email Print |
|
You are here: Home > Internet and Businesses Online > Web Development > Form Checking - Verifying Name Using PHP Ereg |
|
Casual Articles - Form Checking - Verifying Name Using PHP Ereg
Lucrative Advertising Online - How to Get Started With Online Advertising ed "[]" as the outer brackets. As for "-", we left it out because it is normally used as a range within the brackets "[]", like so [A-Z].This could be the question for most business owners. With so many advertising schemes that you can come up with, you might wonder where to start. There are numerous choices but where ever you want to start with, you can be sure that you would be able to get tremendous results in no time.Here are the ways on how to effectively advertise online.1. Try ezines. Yes, if you want a l Implementation To implement it in PHP, we write the code as follows: $pattern = '([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+'; We stripslashed the name field just in case your have magic quot Just Ask One Simple Question One important use of Regular Expressions (Regex) is to verify fields submitted via a form. In this article, we attempt to write an expression that is able to verify the user's first name, middle name, last name or just names in general.According to an article published in The Harvard Business Review there is a high degree of correlation between sales growth and customer satisfaction scores. Well, yeah! That’s logical. Satisfied customers return to vendors who perform at a high level. Additionally they refer others so, obviously, higher levels of satisfaction should normally translate into increased sales volume. But h The expression should allow names such as "Mary", "Mr. James Smith" and "Mrs O'Shea" for example. So the challenge here is to allow spaces, periods and single quotation marks in the name field and reject any other characters. Elimination Technique We try to identify and detect all illegal characters in the name field. I came up with the following list: Punctuations: ~`!@#$%^&*()=+{}|:;<>"/?, Numerics: 0-9 Noticed that I left out the empty space ( ), period (.) and single quotation mark (') because we are allowing these 3 characters to pass the verification. In other words, the verification will fail if the name field contains any of the punctuations or numerics above. The Regex Now, the hardcore part. The regex pattern I came up with is as follows: ([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+ Let me briefly explain what this pattern means. The expression can be represented by: (expression1 | expression2 | expression3 | expression4 | expression5) What we are trying to do here is to match the name field to the patterns in expression 1, 2, 3, 4 or 5. If you look at the regex closely, you will see that expression1 is actually [[:digit:]]. Expression2 is: [~`!@#$%^&*()_=+{}|:;<>"/?,] Noticed that I added a backslash () before each of the 5 characters "()+|". By backslashing these characters, I am telling the function to treat the characters as it is and not as special built-in characters. For example, the brackets "()" actually means grouping in regex but if I backslash it, ie "()", it simply means that I want to match "(" and ")". Expression3 is "[", expression 4 is "]" and expression 5 is "-". We left out the 3 characters "[]-" in expression2 just to avoid confusion because we already used "[]" as the outer brackets. As for "-", we left it out because it is normally used as a range within the brackets "[]", like so [A-Z]. Implementation To implement it in PHP, we write the code as follows: $pattern = '([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+'; We stripslashed the name field just in case your have magic quote Public Relations for Amusement Parks to identify and detect all illegal characters in the name field. I came up with the following list:Amusement Parks all too often get a bad rap and negative reputation that they do not deserve. This is because often they attract so many people that they also attract the bad element too and this is said to bring in crime. Of course anytime you increase the number of people in an area you have to realize that the crime also goes up. But also consider all the good things that large Amusement Punctuations: ~`!@#$%^&*()=+{}|:;<>"/?, Numerics: 0-9 Noticed that I left out the empty space ( ), period (.) and single quotation mark (') because we are allowing these 3 characters to pass the verification. In other words, the verification will fail if the name field contains any of the punctuations or numerics above. The Regex Now, the hardcore part. The regex pattern I came up with is as follows: ([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+ Let me briefly explain what this pattern means. The expression can be represented by: (expression1 | expression2 | expression3 | expression4 | expression5) What we are trying to do here is to match the name field to the patterns in expression 1, 2, 3, 4 or 5. If you look at the regex closely, you will see that expression1 is actually [[:digit:]]. Expression2 is: [~`!@#$%^&*()_=+{}|:;<>"/?,] Noticed that I added a backslash () before each of the 5 characters "()+|". By backslashing these characters, I am telling the function to treat the characters as it is and not as special built-in characters. For example, the brackets "()" actually means grouping in regex but if I backslash it, ie "()", it simply means that I want to match "(" and ")". Expression3 is "[", expression 4 is "]" and expression 5 is "-". We left out the 3 characters "[]-" in expression2 just to avoid confusion because we already used "[]" as the outer brackets. As for "-", we left it out because it is normally used as a range within the brackets "[]", like so [A-Z]. Implementation To implement it in PHP, we write the code as follows: $pattern = '([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+'; We stripslashed the name field just in case your have magic quot Buying Radio? Read This and Don't Waste Your Money me up with is as follows:Pay close attention and make it work the best for you.No doubt you’ve listened to, and then quickly deleted, messages from account execs from your local radio stations. Maybe you’ve even entertained them in your office. Hopefully you didn’t have to sanitize your phone or office afterwards.Well, radio can be great way to garner awareness cheaply... ahem, inexpensively. ([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+ Let me briefly explain what this pattern means. The expression can be represented by: (expression1 | expression2 | expression3 | expression4 | expression5) What we are trying to do here is to match the name field to the patterns in expression 1, 2, 3, 4 or 5. If you look at the regex closely, you will see that expression1 is actually [[:digit:]]. Expression2 is: [~`!@#$%^&*()_=+{}|:;<>"/?,] Noticed that I added a backslash () before each of the 5 characters "()+|". By backslashing these characters, I am telling the function to treat the characters as it is and not as special built-in characters. For example, the brackets "()" actually means grouping in regex but if I backslash it, ie "()", it simply means that I want to match "(" and ")". Expression3 is "[", expression 4 is "]" and expression 5 is "-". We left out the 3 characters "[]-" in expression2 just to avoid confusion because we already used "[]" as the outer brackets. As for "-", we left it out because it is normally used as a range within the brackets "[]", like so [A-Z]. Implementation To implement it in PHP, we write the code as follows: $pattern = '([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+'; We stripslashed the name field just in case your have magic quot Why All Your Article Advertising Should Focus On A Single Web Page ed that I added a backslash () before each of the 5 characters "()+|". By backslashing these characters, I am telling the function to treat the characters as it is and not as special built-in characters. For example, the brackets "()" actually means grouping in regex but if I backslash it, ie "()", it simply means that I want to match "(" and ")".One highly effective web advertising article marketing technique that I use all the time is to focus on one web page at a time and to direct all traffic to that particular page. This is much more effective than linking to a web site home page.I can hear you ask how you'll manage to increase page views and get the visitors to see the other pages on the site. This can be accomplished ea Expression3 is "[", expression 4 is "]" and expression 5 is "-". We left out the 3 characters "[]-" in expression2 just to avoid confusion because we already used "[]" as the outer brackets. As for "-", we left it out because it is normally used as a range within the brackets "[]", like so [A-Z]. Implementation To implement it in PHP, we write the code as follows: $pattern = '([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+'; We stripslashed the name field just in case your have magic quot Payroll Tennessee, Unique Aspects of Tennessee Payroll Law and Practice ed "[]" as the outer brackets. As for "-", we left it out because it is normally used as a range within the brackets "[]", like so [A-Z].Tennessee has no State Income Tax. There for there is no State Agency to oversee withholding deposits and reports. There are no State W2's to file, no supplement wage withholding rates and no State W2's to file.Not all states allow salary reductions made under Section 125 cafeteria plans or 401(k) to be treated in the same manner as the IRS code allows. In Tennessee cafeteria plans Implementation To implement it in PHP, we write the code as follows: $pattern = '([[:digit:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+'; We stripslashed the name field just in case your have magic quotes turned on. If magic quotes is turned on, the single quotation mark will be passed as ' instead just '. The ereg function will look for digits and illegal punctuations in the $_POST name field. If an error is found, we can do something such as alerting the user of the error. Conclusion Hopefully, this article can give you some insight into regex and save you some time when verifying name fields. You can modify the regex to have stricter rules for example, you may not want the name field to start with a space or a period. That's all for now. Cheers.
HTTP = HTML link (for blogs, profiles,phorums):
Related Articles:Advertising Balloon Signage for Promotion Is the Role of Marketing Changing What Can An Autoresponder Do To Help My Affiliate Marketing Business?
|