Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
Perl
Regular Expression 189 codes
Home
Perl
Regular Expression
1 $1 gets A, $2 gets B
2 $text =~ tra-zd-za-c
3 $text =~ trd-za-ca-z
4 @a = split (, $s)
5 A greedy quantifier
6 A negative look ahead
7 A negative look behind
8 A positive look ahead
9 A positive look behind
10 A program that illustrates the use of the matching operator
11 A program that loops using a pattern
12 A simple integer-validation program
13 A word-count program that handles multiple spaces and tabs between words
14 Alternation
15 Anchoring Metacharacters
16 B matches only if the pattern is contained in a word
17 Back referencing
18 Backreferencing and greed
19 Backreferencing and greedy quantifiers
20 Beginning and end of word anchors
21 Beginning of line anchor
22 Capitalize all sentences
23 Changing substitution delimiters
24 Character Class
25 Check beginning
26 Check beginning and end
27 Check end
28 Check for 4-8 as
29 Check for a
30 Check for a or b
31 Check for and remove a trailing backslash character
32 Check for digit
33 Check for leading alpha character, rest alphanumeric
34 Check for no a
35 Check for no digit
36 Check for white space
37 Check the frequency
38 Checking for multiple occurrences
39 Clustering and anchors
40 Clustering or grouping
41 Combine [] with + to match a sequence of characters of any length
42 Count the match times
43 Counting using tr
44 D f matches d, followed by any non-newline character, followed by f
45 De{1,3}f matches d, followed by one, two, or three occurrences of e, followed by f
46 Defaults to split( , $_)
47 Determine if a string has a digit
48 Divide according to multiple separators
49 Divide it into a specific number of fields
50 Ei modifier
51 End of line anchor
52 Escape Sequences for Special Characters
53 Escape sequences, n and t
54 Evaluate replacement
55 Get all numbers
56 Get begin of the line
57 Greedy and non-greedy quantifiers
58 Greedy Matches
59 Greedy searches
60 Grep {$_ = 2}
61 Grep function with regular expression
62 Grep value
63 Grep with regular rxpression
64 If ($text =~ (d+)) {print Heres the number of apples
65 If ($text =~ ^[+-]d+ d$) {print Its a number ;}
66 If ($text =~ ^d+$) {print Its a number ;}
67 If ($text =~ D) {print Its not a number ;}
68 Ignore case, global substitution
69 Increase salary with pattern match
70 Inline Modifiers
71 Introducing the translation operator
72 Iterate over matches with foreach and $_ and nested foreach
73 Iterate over matches with foreach and $_ and nested while loop
74 Iterate over matches with while and $1
75 Match any number of alphanumerics followed by a single space character
76 Match at least one alphanumeric followed by a single space character
77 Match case
78 Match multiline patterns
79 Match numbers
80 Match one or zero alphanumerics followed by a single space character
81 Match the first alphanumeric character
82 Match the new line character
83 Match the one or more alphanumerics
84 Match zero or one characters
85 Matched index
86 Matching Any Letter or Number
87 Matching Modifiers
88 Meta-Character ASCII Values
89 Metacharacters and metasymbols
90 Metacharacters for Single Characters
91 Meta-Characters listing
92 Metacharacters that Turn off Greediness
93 Metasymbols and subpatterns
94 Multiplies every integer in a file by 2
95 Occurences of planet were changed to world
96 Options for the S Operator
97 Options for the substitution operator
98 Options for the translation operator
99 Parentheses and regex
100 Pattern anchors in Perl
101 Pattern array
102 Pattern match
103 Pattern Matching Operators
104 Pattern Modifiers
105 Pattern Tester
106 Pattern-Matching Operators(The syntax used to perform a pattern match on a string)
107 Pattern-matching options
108 Patterns containing + always try to match as many characters as possible
109 Posix and Unicode Classes
110 Print line unless it matches E
111 Regex index
112 Regular expression
113 Regular expression character patterns
114 Regular expression metacharacters
115 Regular expression modifiers
116 Regular expression pattern quantifiers
117 Regular Expression Patterns
118 Repeating patterns
119 Replace pattern
120 Replace pattern with ()
121 Reversing subpatterns
122 Searching from the beginning and the end
123 Shortcut Expansion Description
124 Shortcuts for Regular Expressions
125 Shortest possible match
126 Shouldnt start a sentence with a period
127 Skip blank lines and comments
128 Some Regular Expression Metacharacters
129 special-character combination tries to match as much as possible
130 Split a string by using the regular expression
131 Square brackets ([ and ]) delimits a range of characters
132 Substitute every T with M
133 Substitute first occurrence of blue with red
134 Substitute first T with an M
135 Substitute I with N and print
136 Substitute N with J
137 Substitute tom with Mary
138 Substitution Example
139 Substitution Modifiers
140 Swap the first two words in a string
141 The [] special characters enable you to define patterns that match one of a group of alternatives
142 The ^ and $ Pattern Anchors
143 The bracket metacharacters and negation
144 The bracketed character class
145 The dot metacharacter
146 The dot metacharacter and the zero or more quantifier
147 The e modifier
148 The e Modifier Evaluating an Expression
149 The g Modifier Global Substitution
150 The Greedy Metacharacters
151 The greedy quantifier
152 The grep function evaluates the expression (EXPR) for each element of the array (LIST)
153 The i Modifier Case Insensitivity
154 The m modifier controls the behavior of the $ and ^ anchor metacharacters
155 The m Operator and Matching
156 The metasymbol, d
157 The S metasymbol and nonwhitespace
158 The s metasymbol and whitespace
159 The s Modifier-The Dot Metacharacter and the Newline
160 The s Operator and Substitution
161 The s operator supports a number of variables
162 The split function splits up a string EXPR by some delimiter (whitespace by default) and returns an array
163 The word metasymbols
164 The x Modifier
165 To get at each field, we can split when we see a colon
166 To specify a maximum number of occurrences, use 0 as the lower bound
167 To specify a minimum number of occurrences, leave off the upper bound
168 Tra-zA-Z
169 Trio
170 Troi
171 Turning Off Greediness
172 Use G to match rest of text
173 Use gc to remember position
174 Using alternate with parentheses
175 Using alternate without parentheses
176 Using grep function
177 Using grep to remove word
178 Using grep with expression
179 Using grep with the file-test operators
180 Using Patterns with Substitutions
181 Using Special-Meaning Characters
182 Using split and pattern matching
183 Using split, an anonymous list, and pattern matching
184 Using substitutions to clean up input data
185 Using tr to count the occurrences of specific characters
186 Using tr to retrieve the length of a string
187 Using variables containing matched subpatterns
188 Word-Boundary Pattern Anchors
189 Zero width loop