![]() |
Inexact Matches in Regular Expressions![]() ![]() ![]() ![]() ![]()
The previous examples use exact for the regular expressions. You give the exact characters you want to match. However, you often don't know the exact characters for which you are looking. For example, you may be searching for "the letter x or the letter X,"or"one or more hash characters," or even "a hash character followed by any other character followed by a hash character. Regular expressions make these kind of inexact matches fairly easy. To indicate that you want to match either one character or another, you use the variable bar (1) between each character you may want to match. This is called alternating because you give Perl a list of alternates to look for. For example, to search for either "x* or X, you may use if($Test =~/(xiX)/) . . This code will match exactly one *x" or "V. Like in numeric equations, you can use parentheses around a group of related items in your regular expression. You can have more than one kind of thing in a regular expression, such as a fixed expression and alternating list. For example, to search for "candle,* 'candy, and "cancer", you coule use if($Test =~ /can(dleldylcer)/). . . If you don't know which character you want to match, you use a period as a wildcard character. For example, if you want to match "the letter N followed by any character followed by the letter T," you would use if($Test = /N T/) ...
|
|
PERL Perl Program Data Types Types of Variables Operator Types Functions String Functions Array Functions Expressions Statement Blocks The if Statement Unless Statement While Loops Until Loop For Loop Foreach Loop Jump Keywords Subroutines Perl References Die Function Exit Function Localtime Function Standard Files File Test Operators File Functions Opening Files Reading into Hash Printing Revisited Globbing Splitting a Record into Fields Perl's Special Variables Regular Expression Simple True-False Searches Inexact Matches in Regular Expressions Matching Any Character Characters with Class Special Locations Quantifiers Greedy Matching Modifiers Localtime Function Subsituations Letter for Letter Translations Generating A Simple Report Defining a Report Template Specifying the Picture Line Specifying the Argument Line Adding a Header Writing the ReportDomain Names Home Importance of a domain name How does a web domain name work? Domain name syntax Choosing a domain name Domain Transfer Domain Parking IP AddressWeb Design HTML DHTML XML JAVASCRIPT VBSCRIPT PHOTOSHOPWeb Hosting Web Server Web Server Software Microsoft Internet Information Server Web hosting ISP Shared web hosting Virtual web hosting Dedicated web hosting Web hosting colocation Managed web hostingE Commerce Principles of E-Commerce E-Banking Electronic Payment System E-Security Credit Cards Smart Cards
The Mailbox POP Server SMTP Server IMAP Protocol |
| Home | Web Hosting | Web Design | Sitemap |
| Copyright (C) 2007. Web Domain design hosting. All rights reserved. |