Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> The Absolute Bare Minimum Every Programmer Should Know About Regular Expressions
dserban
post Aug 16 2007, 08:46 PM
Post #1


Premium Member
Group Icon

Group: [HOSTED]
Posts: 286
Joined: 17-June 07
Member No.: 22,702



Well, the title says it all and I really don't have anything to add to that, except to say that this is a really, really powerful technology that is very pervasive in many programming as well as scripting languages and as well in mainstream database products.

I really recommend you put in the time and effort to learn regular expressions, they are power tools that are going to open for you a whole new world of text processing possibilities.

Link:
http://immike.net/blog/2007/04/06/the-abso...ar-expressions/
Go to the top of the page
 
+Quote Post
develCuy
post Aug 16 2007, 10:59 PM
Post #2


Member - Active Contributor
Group Icon

Group: Members
Posts: 88
Joined: 5-April 07
From: Cusco - Peru
Member No.: 21,283



regexp in PHP Arrays:

Clear blanks:
CODE
$array = preg_grep('/[^$]/', $array);


Patterns for zip codes
CODE
$zip_code = str_replace(' ','','ZIP CODE');

    $pattern = array(
      array(
        '/^[[:alnum:]]{6,6}+$/',
        '/[[:alpha:]]/',
        '/[[:digit:]]/'
      ),
      array(
        '/^(\d){5,5}+$/'
      )
    );
        $is_zip_code = true
    for($_j = 0; $_j < count($pattern[$_i]); $_j++){
      $is_zip_code = ($is_zip_code and preg_match($pattern[$_i][$_j],$zip_code));
    }


Regexp have power to resume your code in rules, then you are able to change the pattern easily.
There are many tools to create regexp patterns.

Blessings!

This post has been edited by develCuy: Aug 16 2007, 11:00 PM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. About Programmer(13)
  2. One Stop For Web Scriptings(7)
  3. HTML 101 - Web Design For Beginners(7)
  4. Resources For Beginner Delphi Programmer ?(11)
  5. Megatsunamis(9)
  6. Difference Between Starter And Regular(3)
  7. Basic C++ Tutorial(3)
  8. How To Get Absolute Path To Website?(9)
  9. A Web Designer And Programmer For 10 Years(1)
  10. Evolution Of A Programmer(10)
  11. What's Life As A Programmer Like In Your Country?(26)
  12. Airtel GPRS(23)
  13. Any Active & Regular Vietnamese Member At Astahost ?(3)
  14. Is There A Minimum Resolution For Video Cards?(7)
  15. Announcement: Importance Of Regular Site Backups !(18)
  1. The Question Of Ethics(5)
  2. Need Assisstance With A Game Like Knights Of Nobelmen(0)
  3. The Case For Open Theism.(1)
  4. How To Remove Query String Using Regular Expressions(4)
  5. Php 101: Php For The Absolute Beginner(2)
  6. Getting Absolute Position Of Non-absolute Elements(5)
  7. Facebook Graffiti(10)
  8. Good News To Programmer, Google Code(0)
  9. Filtering Out Unwanted Junk Mail Using Regular Expression.(0)
  10. Regular Expressions Not Matching(4)
  11. Using Regular Expressions To Parse Functions(5)
  12. An Absolute Basic Guide To Algorithms For Dummies(0)
  13. Regular Expressions(6)


 



- Lo-Fi Version Time is now: 11th October 2008 - 06:14 PM