p[1] (sometimes called a rational expression)[2][3] is a sequence of characters that define a search pattern.Usually this pattern is used by string searching algorithms for "find" or "find and replace" operations on strings, or for input validation. It is a technique that deve when the American mathematician Stephen Cole Kleene formalized the description of a regular language. The concept came into common use with Unix text-processing utilities. Since the 1980s, different syntaxes for writing regular expressions exist, one being the P r, widely used, being the Perl syntax. Regular expressions are used in search engines, search and replace dialogs of word processors and text editors, in text processing utilities such as sed and AWK and in lexical analysis. Many programming languages provide rege essions, and consequently, regexes, is often used to mean the specific, standard textual syntax (distinct from the mathematical notation described below) for representing patterns for matching text. Each character in a regular expression (that is, each character in the either a metacharacter, having a special meaning, or a regular character that has a literal meaning. For example, in the regex a., a is a literal character which matches just 'a', while '.' is a meta character that matches every character except a newline. Therefore, this r 'a0'. Together, metacharacters and literal characters can be used to identify text of a given pattern, or process a number of instances of it. Pattern matches may vary from a precise equality to a very general similarity, as controlled by the metacharacters. For example a-z]a (match lower case letters fromis 'a' 'z') is aless general and a isdifferent a preciseways pattern The metacharacter syntax ismatches designedboth specifically toand represent prescribed targets a concise way to direct the automation of textasprocessing a var of regular all expression in this syntax toto locate word spelled two in a (matches text editor,just the'a'). regular expression seriali[sz]e "serialise" "serialize". Wildcards also in achieve this,and but flexible are more limited in what they can pattern, they haveoffewer wildcard characters is in globbing similar names in a list of files, whereas regexes are usually employed in applications that pattern-match text strings in general. For example, the regex ^[ \t]+|[ \t]+$ matches excess whitespace at the beginning or end of a line. An ad nslates a regular expression in the above syntax into an internal representation which can be executed and matched against a string representing the text being searched in. One possible approach is the Thompson's construction algorithm to construct a nondeter tenation) RS denotes the set of strings that can be obtained by concatenating a string in R and a string in S. For example, let R = {"ab", "c"}, and S = {"d", "ef"}. Then, RS = {"abd", "abef", "cd", "cef"}.(alternatio
med that the Kleene star has the highest priority, then concatenation and then alternation. If there is no ambiguity then parentheses may be omitted. For example, (ab)c can be written as abc, and a|(b(c*)) can be written as a|bc*. Many textbooks use the symbols ,"xz" xpression. Matches a single character that is contained within the brackets. For example, [abc] matches "a", "b", or "c". [a-z] specifies a range which matches any lowercase letter from "a" to "z". These forms can be mixed: [abcx-z] matches "a", "b", "c", "x", "y", or "z", as does [a-cx-z]. ,"xz" x", "ycharacter that is not a lowercase letter from "a" to "z". Likewise, gle character that is not contained within the brackets. For example, [^abc] matches any character other than "a", "b", or "c". [^a-z] matches any single literal characters and ranges can be mixed. ,"xz" ", "z", ,"xyz" eceding element zero or more times. For example, ab*c matches "ac", "abc", "abbbc", etc. [xyz]* matches "", "x", "y", "z", "zx", "zyx", "xyzzy", and so on. (ab)* matches "", "ab", "abab", "ababab", and so on. A bracket expression. Matches a single character that is contained w "zx", zyx"
"zyx", (also known as alternation or set union) operator,"ymatches z e. For example, ab?c matches only "ac" or "abc".Matches the preceding element one or more times. For example, ab+c matches "abc", "abbc", "abbbc", and so on, but not "ac".The choice either the expression before or the expression after the operator dna "xyz zy", and characters match sozy", on. (ab) and
)ba( .n,o"ydzonsa
ca" a larger set of characters. )ba( .no os For example, [A-Z] could stand for the uppercase al ,c"cab" a" ," "ac so on. (ab) "cbbctin beaa", identifiers. "," ass understood byx",some tools is [:word:], which is usually defined as [:alnum:] plus underscore. This reflects the fact that in many programming languages these are the characters that be used The editor Vim further distinguishes word and word-h ", "abc", "x"*,may "]"zsyexh "y "ac " ,"y" ,"x" ,"" se"h,c"yta" ,m [ .ccttaem, *]zy,x"[c.b a ,"yzzyx" ,"xyz" ,"xz" a,"z,"yzzyx" a,"x,y"yzz" z,"yxxz"" ,,""xzyz" ,"xz" ,"z ", "z", *]zyx[ .cte ,"cbbba" ,"cba" ,"ca" ","abbbc" "abc", e of reading, many other utilities and programming languages have adopted syntax similar to Perl's—for example, Java, JavaScript, Python, Ruby, Qt, Microsoft's .NET Framework, XML and tools such as Boost and PHP support multiple regex flavors. P ,"xz" " ,"z" ,"ySome " ,"x" ,"" selanguages hctam , etc. [xyz]* and matches "", "x",Schema. "y", "zx", The character class is the most basic regex concept after a literal match. It makes one small sequence of
z", "zx", "zyx", "xyzzy", z", "zx", "zyx",a "xyzzy",m a ]cba[ a ,"yzzyx" ,"xyz" "ac", "abc", "abbbc", etc. [xyz]*
"zyx",
matchesextensions "", "x", "y", "z", "zx", ,"b" , "adeveloped " sehcta et of features found in Perl 5.0,"xyzreleased in 1994. Perl sometimes does incorporate features initially found in other languages, for example, Perl 5.10 implements syntactic originally in PCRE and Python.[30] "zyx", "xyzzy", a [abc] m *]zyx[ .cte ,"cThe bbba" ,"cba" ,"ca" ".+" (including the quotes) applied to the string.mat other implementations (e.g. Java), the three common quantifiers (*, + and ?) are greedy by default because they match as many characters as matches possible.[31] ,"xz"s" ],"zz-"a,["y.""c,""x"ro,"" regex sehctam , etc. [xyz]* "", "x", "y", zy", z", "zx", "zyx", "xyzzy", atches , "b", z","a" "zx", "zyx",a "xyzzy", am ,a"yz]czb yxa"[ ,"axy,"zy"zzyx" ,"xyz" "ac", "abc", "abbbc", etc. [xyz]*
and
or "c". [a-z] matches "", "x", "y",s "z",of "zx",such,"character b" , "a" sehcta ranges to Unicode would simply change the requirement that the e character ranges ofon. the extension so (ab)form [x-y] are valid wherever x and y have code points in the range [0x00,0x7F] and codepoint(x) ” codepoint(y). The natural "zyx", "xyzzy", a "y", matches "", "x", "z",m "zx", properties of the form \p{InX} or \p{Block=X} match characters in block X and \P{In ulmplementations, than script properties, because a block library, [abc] "accan have code points from several different scripts, and a script can have code points from several different blocks.[37] In Perl and the java.util.regex "zyx", "xyzzy", [abc] ms ]z-a[s .]"zc-"ar[o."c" ro atches "a" ,a"b", ", "abc", atches Armenian}, or \p{Script=Armenian} matches any character in the Armenian script. In general, \p{X} matches any character with either the binary property X or the general category example, \p{Lu}, \p{Uppercase_Letter}, or \p{GC=Lu} matches any upperca atches "abbbc" or "c". z", "zx", "zyx", ,"a" "x"a" z[a-z] " ,,","b", z"b", " s,"y" ,""xyzzy", xX. " ,"" For saem , etc. [xyz]* matches "", "x", "y", " ,ha"ycz]tczab ymxa"[ ,"xyz" "ac", "abc", "abbbc",s etc. [xyz]* or or"c". "c". [a-z] matches "", [a-z] "x", "y",s "z", s ]z"zx", -a[ ."c" ro matches "", "x", "y", "z",m "zx", [abc] "zyx", ,"xz"xyzzy", " ,"z"a" " ,"y,"a"b", ,"x[abc] " ,"" semhctam atches atches , "b", or "c"."a"[a-z] s or "c". [a-z] s z", "zx", "zyx", "xyzzy", a or "c".
z", "zx", "zyx", "xyzzy", z", "zx", "zyx",a "xyzzy", a "ac", "abc", "abbbc", etc. [xyz]* matches "", "x", "y", "z", "zx", "zyx", "xyzzy", a [abc] m atches "a" , "b", or "c". [a-z] s bbc", [xyz] etc.
z", "zx", " yzzy", a " , "b",
[abc] m [a-z] s [abc] m [abc] matches "a c". [a-z] s ", "b", or " atches "a" , "b", atches "a", "b", or "c". [a-z] s
atches "a"
,"xz" ,"z" ,
atches "a", or"b", "c".or [a-z] "c". s[a-z] s [abc] m Regular expression for an email address$string1 : = "Hello\nWorld\n"; Regular expression for an email address$string1 : if ($string1 = "Hello\nWorld\n"; ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ =~ m/\AH/) { Regular expression for an email address $string1 : = "Hello\nWorld\n"; = "Hello\nWorld\n"; $string1 ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ if ($string1 =~ { "; Regular expression for an email address $string1 : if ($string1 = "Hello\nWorld\n"; $string1 = m/\AH/) "Hello World\n"; "$string1 is a string ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ =~ m/\AH/) { print if ($string1 =~ m/\AH/) { $string1 = "Hello World\n"; "$string1 is a with string "; ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ =~ m/\AH/) { ";print $string1 = {"Hello World\n"; $string1 = "Hello\nWorld\n"; $string1 = = "Hello World\n"; Regular expression for an email addressif :($string1 if ($string1 =~ m/[aeiou]+/) print "that starts 'H'.\n"; print "$string1 is a string $string1 "Hello\nWorld\n"; printprint "$string1 is a string "; = "Hello World\n"; $string1 = "Hello\nWorld\n"; ($string1 =~ with m/[aeiou]+/) { or $string1 =if"Hello "thatWorld\n"; starts 'H'.\n"; "$string1 is a with string "; print if ($string1 =~ m/[aeiou]+/) if ($string1 =~ { $string1 if ($string1 =~ m/...../) { ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ $string1 = m/\AH/) "Hello\nWorld\n"; print "$string1 contains one more vowels.\n";{ } print "that starts 'H'.\n"; $string1 = "Hello World\n"; $string1 = "Hello World\n"; ($string1=~ =~m/...../) m/\AH/) { $string1 = "Hello World\n"; "that startsstarts with 'H'.\n"; { print if ($string1 =~ m/\AH/) { "; if if($string1 print "$string1 contains one or more vowels.\n"; ifWorld\n"; ($string1 =~ m/...../) { World\n"; }$string1 print "that with 'H'.\n"; print "$string1 contains one or more vowels.\n"; $string1 "Hello World\n"; = "Hello print a string print "$string1 "$string1 has length >= 5.\n"; if "$string1 ($string1 is =~ m/\AH/) {print } $string1 = "Hello } if ($string1 =~ m/...../) { if ($string1 =~ m/...../) if ($string1 { = =~World\n"; m/[aeiou]+/) { is=alength string ";World\n"; } >= print "$string1 has 5.\n"; print "$string1 is$string1 a with string "; = "Hello World\n"; $string1 = "Hello } $string1 "Hello print "$string1 has length >= 5.\n"; $string1 = "Hello World\n"; } } if ($string1 =~ m/...../) if ($string1 { =~ m/[aeiou]+/) { print "that starts 'H'.\n"; } print "$string1 is a string "; if ($string1 =~ m/...../) { $string1 = "Hello World\n"; $string1 = "Hello World\n"; print "$string1 has print length "$string1 >= m/[aeiou]+/) 5.\n"; contains one more vowels.\n"; $string1 $string1 = with "Hello ='H'.\n"; "Hello World\n"; World\n"; print "that starts $string1 = "Hello World\n"; string1 = "Hello World\n"; print{ "$string1 has length >= 5.\n"; } print "that starts with 'H'.\n"; if ($string1 =~ m/...../) { if ($string1 =~ { oror if ($string1 =~ m/[aeiou]+/) $string1 = "Hello World\n"; } if ($string1 =~ m/...../) { $string1 = "Hello World\n"; print "$string1 has print length "$string1 >= 5.\n"; contains one more vowels.\n"; } print "that starts with 'H'.\n"; print "$string1 length >= 5.\n"; if ($string1 m/...../) {if ($string1 $string1 = "Hello World\n"; There $string1 is has an 'H' =and "Hello World\n"; separated by 0-1 characters = "Hello (e.g.,World\n"; He Hue Hee). if ($string1 =~ m/...../) }a 'e' }$string1 if{($string1 =~ m/[aeiou]+/) =~ m/[aeiou]+/) { by { characters }=~ $string1 = "Hello World\n"; if ($string1 =~ m/[aeiou]+/) { ($string1 =~ m/...../) { } } There is an 'H' and a 'e' separated 0-1 (e.g., He Hue Hee). $string1 = "Hello World\n"; print "$string1 has length >= 5.\n"; print "$string1 contains one or more vowels.\n"; print "$string1 contains one or more vowels.\n"; if ($string1 =~ m/...../) { "$string1 $string1 = "Hello World\n"; print "$string1 length >=print if5.\n"; ($string1 =~ has m/...../) { >= = "Hello World\n"; There$string1 isif{an 'H'=and "Hello World\n"; separated by 0-1 characters (e.g., He Hue $string1 ==~ "Hello World\n"; }a 'e' } has=~ }oneby length 5.\n"; if ($string1 m/[aeiou]+/) ($string1 =~ m/(H..).(o..)/) {}$string1 if ($string1 =~ m/...../) { Hee). There is an 'H' and a 'e' separated 0-1 characters (e.g., He Hue Hee).print $string1 = "Hello World\n"; print "$string1 has length >= 5.\n"; print "$string1 print "$string1 contains contains or one more or vowels.\n"; more vowels.\n"; if ($string1 m/...../) { $string1 = "Hello World\n"; "$string1 contains one or more print "$string1 has length >= 5.\n"; $string1 = "Hello World\n"; if ($string1 =~ m/...../) { vowels.\n"; print "$string1 }has} length >= 5.\n";has if }($string1 m/(H..).(o..)/) {Hee). ==~ "Hello World\n"; }{ if ($string1 } print "$string1 length >= 5.\n"; =~ m/...../) { if $string1 ($string1 m/(H..).(o..)/) if=~ ($string1 m/[aeiou]+/) There is an 'H' a 'e' separated 0-1} characters (e.g.,=~ He Hue print "$string1 contains one or{more vowels.\n"; print "We matched '$1' and '$2'.\n"; print "$string1 has length >= 5.\n"; if ($string1 =~ m/...../) { >= 5.\n"; }has and }by print "$string1 length >= 5.\n"; if ($string1 =~ m/(H..).(o..)/) { $string1 = "Hello World\n"; } if{($string1 =~ m/...../) { has>= print "$string1 length } There print "We matched '$1' and '$2'.\n"; if ($string1 =~ m/(H..).(o..)/) } aa'e' print "$string1 has length 5.\n"; print matched '$1' and '$2'.\n"; print (e.g., "$string1 contains one more vowels.\n"; Thereisisan an'H' 'H'and and 'e'separated separatedby by 0-1 characters (e.g., He Hue Hee). 0-1 characters He Hue Hee). } matched } or"We } "$string1 has length >= 5.\n"; } There "We '$1' '$2'.\n"; =~ m/(H..).(o..)/) print has"$string1 length >= 5.\n"; } print is an 'H' and a 'e' separated byprint (e.g., Heand Hue Hee).}if ($string1 $string1 ='$1' "Hello }0-1 characters print "We matched and {World\n"; '$2'.\n"; } } } } 0-1 characters (e.g., He Hue Hee). print "We matched '$1' =~ andm/(H..).(o..)/) '$2'.\n"; There is an 'H' and a 'e' separated by } if ($string1 { } } print "We matched '$1' and '$2'.\n"; }
Designed by ďźšLiu Xinyi
ehctam
"a" "a"
so (ab)
so
"z", "zx", atches "a" ,"xz" ,"xz" ,"z" ,"y" matches "", , "zx", ,"xz" ,"z" ,"y" ,"x" ,"" [abc] matches "a c". [a-z] s ", "b", or " atches "a",atches "b", or [a-z] s "a""c". , "b", atches "a", "b", or "c". [a-z] s $string1 = "Hello World\n"; atches "a",or"b", "c".or[a-z] "c". s[a-z] s [abc] m = "Hello\nWorld\n"; Regular expression for an email address$string1 : $string1 = "Hello World\n"; { Regular expression for an email address : if ($string1 =~ m/[aeiou]+/) $string1 = "Hello World\n"; $string1 = "Hello\nWorld\n"; if ($string1 =~ m/\AH/) { ifprint ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ Regular expression for an email address : Regular expression for an email address$string1 : = "Hello\nWorld\n"; ($string1 =~World\n"; m/[aeiou]+/) ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ "$string1 contains one {or more vowels.\n"; $string1 = "Hello Regular expression for an email address : $string1 = "Hello\nWorld\n"; if ($string1 =~ m/[aeiou]+/) { or if ($string1 =~ m/\AH/) { $string1 = "Hello World\n"; Regular expression for an email address : print "$string1 is a string "; ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ if ($string1 =~ m/\AH/) { contains {one more vowels.\n"; Regular^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ expression for an email address : } print "$string1 if ($string1 =~ m/[aeiou]+/) ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ $string1 = "Hello if ($string1 =~ m/\AH/) Regular { expression for an email address : print "$string1 contains$string1 one or more vowels.\n"; "$string1 is a World\n"; string "; if ($string1 =~ with m/[aeiou]+/) { ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ "that starts 'H'.\n"; $string1 =for"Hello World\n"; =print "Hello World\n"; $string1 = "Hello World\n";$string1 = "Hello World\n"; $string1 = "Hello\nWorld\n"; print "$string1 is a string "; print } "$string1 ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ print contains one or more vowels.\n"; Regular expression an email address : $string1 = "Hello World\n"; $string1 = "Hello World\n"; $string1 = "Hello World\n"; if=~ ($string1 =~ print "$string1 is a^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ string{ "; if ($string1 =~ m/...../) { print "that starts with 'H'.\n"; = "Hello World\n"; } $string1 print "that starts with 'H'.\n"; { print "$string1 contains one or more vowels.\n"; } if ($string1 m/...../) { m/[aeiou]+/) if ($string1 =~ m/\AH/) if ($string1 =~ m/...../) { if ($string1 =~ m/...../) $string1 World\n"; { $string1 = "Hello World\n"; Regular expression for an email address$string1 : { "that starts with } {= "Hello ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ = "Hello World\n"; if ($string1 =~ m/[aeiou]+/) if ($string1 =~ m/...../) if ($string1 =~ m/...../) { print "$string1 print 'H'.\n"; if ($string1 =~ m/[aeiou]+/) { } } print "$string1 has length contains >= 5.\n";one or more vowels.\n"; print "$string1 has length >=print 5.\n"; print "$string1 is a string "; print "$string1 has length}>= 5.\n"; if ($string1 =~ m/[aeiou]+/) { if ($string1 =~ m/...../) { ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ "$string1 has length >= 5.\n"; if ($string1 =~ m/...../) { print "$string1 contains one or more vowels.\n"; print "$string1 has length >= 5.\n"; print "$string1 has length >= 5.\n"; Regular expression for an email address } print(e.g., "$string1 contains or}more vowels.\n"; = :"Hello $string1 = "Hello World\n"; There is an 'H' and a 'e' separated by 0-1 characters } World\n"; } or one } print "that starts$string1 with 'H'.\n"; He Hue Hee). $string1 = "Hello World\n"; $string1 = "Hello World\n"; $string1 = "Hello World\n"; contains one more vowels.\n"; "$string1 has}print length"$string1 >= 5.\n"; } ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ print{ "$string1 has length print >= } 5.\n"; } } if ($string1 =~ m/[aeiou]+/) =~ m/...../) Regular expression for an email address :{ if ($string1 } =~ m/...../) if ($string1 =~ m/...../) { if ($string1 if ($string1 =~ m/[aeiou]+/) {{ $string1 = "Hello World\n"; } characters (e.g., He Hue Hee). }a 'e'World\n"; There isvowels.\n"; an 'H'=and separated by 0-1 $string1 "Hello $string1 = "Hello^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ World\n"; Regular expression for an email addressprint : }oneby print "$string1 contains or more "$string1 hasone length >=and 5.\n"; There is an a 'e' separated 0-1 characters (e.g., He Hue Hee). print "$string1 has length >= print 5.\n"; "$string1 has print length "$string1 >= 5.\n"; or'H' more vowels.\n"; if ($string1 =~ m/...../) { :contains $string1 = "Hello World\n"; Regular expression for an email address $string1 = "Hello World\n"; ($string1 =~ m/(H..).(o..)/) { if ($string1Regular =~ m/[aeiou]+/) ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ {for Regular expression foran anemail emailaddress address:: $string1}= "Hello World\n"; expression } if ($string1 =~ m/(H..).(o..)/) { if } }World\n"; } m/...../) print=address "$string1 ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ $string1 = "Hello World\n"; $string1 = "Hello World\n"; Regular expression forvowels.\n"; an email : has{ length >= 5.\n"; if$string1 ($string1 =~ $string1 = "Hello "Hello\nWorld\n"; print "We matched '$1' and '$2'.\n"; print "$string1 contains one or more ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ if ($string1 =~characters m/(H..).(o..)/) { Hue ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ There is an 'H' a} 'e' separated by 0-1 (e.g., He Hee). print "We matched '$1' and '$2'.\n"; if ($string1 =~ m/...../) { and ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ "$string1 has length ifprint {>= 5.\n"; if ($string1 { ($string1 $string1 = "Hello\nWorld\n"; Regular for=~ an email address : '$1'(e.g., }if ($string1 =~ m/(H..).(o..)/) { } There=~ is m/...../) an 'H'expression and a 'e' $string1 separated =m/\AH/) "Hello by 0-1 World\n"; characters He Hue Hee). print "We matched and}'$2'.\n"; print "We matched '$1' and '$2'.\n"; print "$string1 has length >= 5.\n"; is=~ a string ";= "Hello\nWorld\n"; print "$string1 has length >=if"$string1 5.\n"; $string1 if ($string1 =~ m/\AH/) ^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$ { } print ($string1 m/(H..).(o..)/) { } } } print } "$string1 is a string "; print "that 'H'.\n"; if ($string1 =~and m/\AH/) printstarts "We with matched '$1' '$2'.\n";{ } print "$string1 is a string "; print "that starts with 'H'.\n"; } print "that starts with 'H'.\n"; } }
Irregular Expression