Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

Search: 

  Tutorial: PHP Miscellaneous Perl Compatible Regular Expressions Tutorial

PHP string functions give you the ability to manipulate text but sometimes some manipulations get very complicated. Regular expressions (regex) give you more power and control than the normal string functions. On this tutorial we are going to review the u

Tutorial Details:

Compatible Regular Expressions

We are going to review three of the main regex functions:
1. preg_match() used to find text within a string
2. preg_match_all() used to find all matching occurrences of a search within a
string.
3. preg_replace() used to replace string matches with another text
4. preg_match()

To use preg_match() you need to establish 3 arguments; a regular expression, the source string and a array variable. preg_match() returns 1 if a match is found and 0 if no match is found.

Lets see the following example:
$text = "The boat is leaving";
if ( preg_match( "/b.*t/", $text, $array ) )
print $array[0]
// prints boat

Here our regular expression is "/b.*t/"; the source string is $text, and $array is where we store the result. As you can see the regex begins and ends with /.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
PHP Miscellaneous Perl Compatible Regular Expressions Tutorial

View Tutorial:
PHP Miscellaneous Perl Compatible Regular Expressions Tutorial

Related Tutorials:

Displaying 1 - 50 of about 1178 Related Tutorials.

Regular Expressions
Java: Regular Expressions Java: Regular Expressions Regular expressions are the most common..., Regular expressions are neither regular nor expressions. And Some people, when
 
Perl Programming Books
Perl This book is about a marriage of two compatible yet unlikely...;      Perl Tutorial Books... for Picking Up Perl. Picking Up Perl is a freely redistributable tutorial book
 
Matching Address using regular expressions
Matching Address using regular expressions Matching Address using regular expressions    ... describes the way to match address using regular expression.For this we are going
 
Eclipse Perl Integration
Eclipse Plugin-Language Eclipse Perl Integration...;   EPIC is an open source Perl IDE based on the Eclipse... assist, perldoc support, source formatter, templating support and a Perl
 
PHP Programming Books
myself started programming in PHP back in 1997 when Perl was at its apogee, and after only two weeks, I had converted most if not all of my Perl scripts into PHP... PHP Programming Books PHP Programming Books
 
Applying Regular Expressions on the Contents of a File
Applying Regular Expressions on the Contents of a File Applying Regular Expressions on the Contents of a File               
 
Open Source PHP
for PHP scripts The main purpose of this tutorial is to kick off the new... and throughout the net regarding PHP. This tutorial will be fairly short, so even... Open Source PHP,Open Source PHP Shopping Cart,Open Source PHP & MySQL
 
PHP Ajax Book
PHP Ajax Book PHP Ajax Book  ...; AJAX and PHP:  Building Responsive Web Applications is the most practical... knowledge of PHP, XML, JavaScript and MySQL, this book will help you understand
 
Expressions
Java: Expressions Java NotesExpressions Expressions are the basic way to create values. Expressions... to combine literals, variables, methods calls, and other expressions. Operators
 
Boolean Expressions
Boolean Expressions Boolean Expressions Name ______________________ Assume the following: int k... of the following expressions. __________ 1 > 2 __________ b __________ k > j
 
Boolean Expressions
Boolean Expressions Boolean Expressions Name ______________________ Assume the following: int k = 10; int j = 6; boolean b = true; Show what is printed by each of the following
 
String Expressions
String Expressions String Expressions Name ______________________ Assume the following: String a = "abc"; String h = "Hello"; String name = "Michael Maus"; Show what is printed
 
Perl Developer
Perl Developer Perl Developer...; Position Vacant: Perl Developer Job Description  We are looking for Perl developers to work on various projects. 
 
MySQL Tutorial - SQL Tutorials
MySQL Tutorial,Free MySQL Tutorials,MySQL Programming Tutorials,Online MySQL Help for Beginners MySQL Tutorial - SQL Tutorials...;  Complete MySQL 5 Tutorial In this section you
 
Summary - Expressions
Java: Summary - Expressions Java: Summary - Expressions Parentheses () have three uses: Grouping to control order of evaluation, or for clarity. Eg, (a + b) * (c - d) After
 
String Regex Methods
, there is some support for regular expressions in the String class.... // Example of splitting lines from input file with regular expression. while
 
Unix and Perl Programmer
Unix and Perl Programmer Unix and Perl Programmer...;  Position Vacant: Unix and Perl Programmer  Job Description  We are looking for Perl Programmers with Unix
 
PERL & CGI Programmer
PERL CGI Programmer PERL & CGI Programmer...;  Position Vacant: PERL & CGI Programmer Job Description  Looking for CGI programmers having knowledge of Perl
 
PHP Jobs
PHP Job, PHP Jobs PHP Jobs  ...; Currently we are looking for PHP programmers to join our development team. You will be involved in the development of websites based on PHP and MySQL. We
 
Pattern and Matcher
that are available in the String class (see String Regular Expressions.... java.util.regex.Pattern precompiles regular expressions so they can... Strings: Compile Regular Expressions for Efficiency at www.javalobby.org
 
Match string using regular expression without Case sensitivity
regular expressions Regular expressions are in Java... Match string using regular expression without Case sensitivity Match string using regular expression without Case sensitivity
 
EasyEclipse for PHP
Eclipse Plugin-Language EasyEclipse for PHP...;    EasyEclipse for PHP contains the tools needed to start developing PHP code: the PHPEclipse IDE, some database tools, as well
 
Regex Exercises 2
. Regular expressions do not have to be written as Java strings (eg, no Java string..." on the second. You will have to be very careful with escaping some regular expression characters, because [ and ] have special meanings in regular
 
PHP Jobs at Rose India
PHP Job,PHP Jobs at RoseIndia.net,Job PHP PHP Jobs...;      We are looking for PHP programmers to become part of our dynamic fast growing team. This PHP Jobs
 
PHP Training
PHP Training PHP Training...;    PHP is one of the most popular, free, efficient... websites. After completing this training you will be able to understand PHP
 
Quartz Tutorial
Quartz Tutorial, Quartz Scheduler, Quartz Job Scheduler Quartz Tutorial        ...;      In this Quartz Tutorial you will how
 
Removing duplicate white spaces from a String
the regular expressions. This section gives you a example for the best illustration... which compiles the text or regular expression i.e. used to search in the specified
 
Free PHP Books
Free PHP Books Free PHP Books  ...; PHP 5 Power Programming In this book, PHP 5's co-creator and two leading PHP developers show you how to make the most of PHP 5's industrial-strength
 
Tikal Eclipse
, C/C++ and Dynamic Languages (Perl, PHP, Python and Ruby) Development. Tikal
 
PHP Web Hosting
PHP Web Hosting,PHP Web Hosting services,PHP Web Hosting Companies,Web Hosting PHP Web Hosting...; PHP is a great scripting language, which is widely
 
PDT - PHP Development Tools
PDT - PHP Development Tools PDT - PHP Development...;    PDT Project PHP Development Tools About PDT The PDT project is working towards providing a PHP Development Tools framework
 
Difference between JSP 2.0 & JSP 2.1
1.2 with several new and interesting features. This version is fully compatible... the knowledge of Java. After going through this tutorial you will be better... expressions in JSP. EL provides the ability to use run-time expressions
 
Java Complete Hibernate 3.0 Tutorial Tutorial
Hibernate Tutorial,Hibernate 3 Tutorials,Java Hibernate Example,Hibernate Online Code Complete Hibernate 3.0 Tutorial...; This tutorial provide step by step instructions on using Hibernate
 
GUI Tutorial I - FIRST DRAFT
Vanilla Java: GUI Tutorial First Draft Table of Contents GUI Tutorial I - FIRST DRAFT Table... after reading this tutorial. The tutorial presents model programs of increasing
 
Complete Hibernate 3.0 Tutorial
Hibernate Tutorial,Hibernate 3 Tutorials,Java Hibernate Example,Hibernate Online Code Complete Hibernate 3.0 Tutorial...; This tutorial provide step by step instructions on using Hibernate
 
Unix Web Hosting
Hosting provides Perl programming, PHP programming and MySQL & PostgreSQL... scripting language. PHP is supported by Unix hosts.  FTP  File Transfer... PHP Support Tickets Crafty Symtax Live Help PHPLinks Webcalendar
 
Regular Expression Search Program
Regular Expression Search Program Regular...;     Regular Expression: Regular Expression is used... be performed by the regular expression. It has both type characters (literal characters
 
Regular Expression Search Program
Regular Expression Search Program Regular...;     Regular Expression: Regular Expression is used... be performed by the regular expression. It has both type characters (literal characters
 
JSF Tutorial for Beginners
JSF TUTORIAL - INTRODUCING   JAVA  SERVER  FACES... the transition phase.   In this three  part  tutorial... with JSF and getting the best of both worlds. ( As this tutorial presumes
 
Rationale for GUI tutorial decisions
Java: Rationale for GUI tutorial decisions Table of Contents Rationale for GUI tutorial decisions Java... their family and friends. Objection: It isn't related to regular programming
 
Capturing Text in a Group in a Regular Expression
Capturing Text in a Group in a Regular Expression Capturing Text in a Group in a Regular Expression   ... illustrates you how to capture the text in a group through the regular
 
Open Source Unique & Miscellaneous written in Java

 
Removing duplicate white spaces from a String
the regular expressions. This section gives you a example for the best illustration... which compiles the text or regular expression i.e. used to search in the specified
 
Open Source Databases
as a preliminary Perl implementation, this is the best iteration of OSDB yet... years of open-source development, compatible with Oracle - and costing a fraction..., and the Perl programming language, have proven themselves as viable alternatives
 
Apache Geronimo Application server Tutorial
it is completely backward compatible with J2EE 1.2 and J2EE 1.3 specifications also...://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html Install ant. Ant is very
 
Retrieving String by using Regular Expression
Retrieving String by using Regular Expression Retrieving String by using Regular Expression   ...; This Example describes the way to retrieve the String using Regular
 
Reset the matcher using regular expression
Reset the matcher using regular expression Reset the matcher using regular expression    ... describes the way to retrieve the String using regular expression. For this we
 
Pattern resetting using regular expression
Pattern resetting using regular expression Pattern resetting using regular expression    ... describes the way to retrieve the String using regular expression. For this we
 
Hibernate Criteria Expression (and)
expressions. You can also build the nested expressions using 'and' and 'or'. Expressions: The Hibernate Criteria API supports a rich set of comparison operators... expressions. Both conditions are 'true' then it xecutes the query otherwise
 
Hibernate Criteria Expression (or)
expressions. You can also build the nested expressions using 'and' and 'or'.  Expressions: The Hibernate Criteria API supports a rich set of comparison... expressions. Any given condition is 'true' then it executes the query
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.