| Answer Upon |
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 |
|
Answer Upon - Form Checking - Verifying Name Using PHP Ereg
You Can Make Money With Online Surveys "(" and ")".Internet is one of the greatest innovations of the modern times. It has created an extremely interesting field of information and also an infinite medium for wealth creation. It is a tool that can turn dust into gold – if you are serious about making money and are willing to work for it.You will read a lot of hype about automatic money-spinners, affiliate programs, etc. Some might wor 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:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-) Business Plan Location Success Tips 2007 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.What does it take to convey your idea to financiers?- How will you organize all that information? What you need is a clear outline and focus.- First you must identify your audience. Who are your potential stakeholders.- Rank them according to importance, but most importantly have a plan on how they affect your future business.In terms of an effective and well acce 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:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-)+ Things to Note When Building a Mailing List >Building a mailing list is one the main thing you can do to forge a relationship with your customers. With a list of contacts, you can inform them of any updates and special offers, and more importantly, when used properly, you can make repeated sales with a group of trusted customers. Let us look at a few important things to note when you start out to build a list.When building a mai 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:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-) Why Do Most Affiliate Marketers Fail? merics above.Affiliate marketing is on of the largest growing sectors of home based businesses today. Promising a proven method of generating income without having to create and produce an actual product, it is no wonder that you see more and more affiliate sites online everyday. Unfortunately, the sad fact is that the vast majority of the sites do not earn their creators enough money to justify the tim 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:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-) Can You Really Make Money Selling New Release CDs & DVDs On eBay? ex closely, you will see that expression1 is actually [[:digit:]].Being an active eBayer, I am often being asked about products to sell. A common question is "Where can I purchase products such as new release CD's DVD's and Video Games for Playstation and X box at a 75% to 100% discount. Well folks, this sort of discount on this type of merchandise is not available from Wholesalers or Dropshippers. The reason being, the competitive nature of the electroni 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:]]|[~`!@#$%^&*()_=+{}|:;<>"/?,]|[|]|-) 3 Surefire Ways To Sell More Advertising Space On Your Website "(" and ")".If your site receives many visitors every month, it’s certainly time to think of how you are going to monetize it, if you are already not. This article is for you if you own a blog or a website with a loyal following. In fact, if you own a forum with many members, these tactics apply to you too.Here are 3 surefire methods to sell more advertising space on your website, and make more p 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 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:A Business Plan-Do You Need One? Make 1000 Per Day From Home, Is it Possible?
|