Miscellaneous
  Home arrow Miscellaneous arrow Using PCREs
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS

Using PCREs
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2002-11-16

    Table of Contents:
  • Using PCREs
  • Section 1
  • Section 2
  • Section 3
  • Wrapping Things Up

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using PCREs


    (Page 1 of 5 )

    In this tutorial, Sam shows you how to use Regular Expressions.

    By : Sam Fullman

    There are a bunch of good elementary tutorials out there on Regular Expressions. Just do a search at google.com.

    However, what I am about to share encapsulates many of the frustrations I encountered in developing expressions that would work every time, and that always captured any variant in the string I was searching.

    So if you're banging your head against the monitor even after you have read other articles, this is the one to read. You can think of this as the advanced class. If you're looking to get file strings off the web and do editing or analysis, you need to know this stuff. You may not always need to be this complex when you develop regex'es, but if you'll study the concepts, you can be assured you've learned something, and have the confidence you'll find what you're looking for (if it's there).

    Before you begin this tutorial, you need to go to the following page I've created for testing Regular Expressions (you'll probably want to bookmark this page).http://samuelfullman.com/team/php/tools/regular_expression_tester_p.php

    Next, you'll want to know the actual php code you can use for any of the outlined regular expressions (regexes) through this tutorial:

    <?php
    $subject 
    "some string strung strong of text";
    $findMatches preg_match_all('/str.ng/',$subject,$matches);
    if(
    $findMatches){
    for(
    $i=0;$i&lt;count($matches[0]);$i++){
    echo 
    $matches[0][$i] . "&lt;BR&gt;";
    }
    }
    ?>

    More Miscellaneous Articles
    More By Codewalkers


       · Thank you for this tut. I read over the section on regular expressions in the PHP...
       · There was I wondering how to get HTML tags out of a chunk of text (and wondering why...
     

    MISCELLANEOUS ARTICLES

    - Using PHP to Stream MP3 Files and Prevent Il...
    - 10 Must Have Firefox Improvements
    - All About OpenOffice 3.0
    - Shell Script Writing
    - Loops in the UNIX Shell
    - The Test in the UNIX Shell
    - Data Streams and the UNIX Shell
    - Control Mechanisms of the UNIX Shell
    - Variables Within the UNIX Shell
    - The Shell and UNIX
    - In Detail: UNIX File Systems
    - Rights Management in UNIX
    - UNIX File Systems
    - The Terminal in UNIX
    - Operating Systems and UNIX





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT