⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perlre.1

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 1
📖 第 1 页 / 共 5 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "PERLRE 1".TH PERLRE 1 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"perlre \- Perl regular expressions.IX Xref "regular expression regex regexp".SH "DESCRIPTION".IX Header "DESCRIPTION"This page describes the syntax of regular expressions in Perl..PPIf you haven't used regular expressions before, a quick-startintroduction is available in perlrequick, and a longer tutorialintroduction is available in perlretut..PPFor reference on how regular expressions are used in matchingoperations, plus various examples of the same, see discussions of\&\f(CW\*(C`m//\*(C'\fR, \f(CW\*(C`s///\*(C'\fR, \f(CW\*(C`qr//\*(C'\fR and \f(CW\*(C`??\*(C'\fR in \*(L"Regexp Quote-LikeOperators\*(R" in perlop..Sh "Modifiers".IX Subsection "Modifiers"Matching operations can have various modifiers.  Modifiersthat relate to the interpretation of the regular expression insideare listed below.  Modifiers that alter the way a regular expressionis used by Perl are detailed in \*(L"Regexp Quote-Like Operators\*(R" in perlop and\&\*(L"Gory details of parsing quoted constructs\*(R" in perlop..IP "m" 4.IX Xref " m regex, multiline regexp, multiline regular expression, multiline".IX Item "m"Treat string as multiple lines.  That is, change \*(L"^\*(R" and \*(L"$\*(R" from matchingthe start or end of the string to matching the start or end of anyline anywhere within the string..IP "s" 4.IX Xref " s regex, single-line regexp, single-line regular expression, single-line".IX Item "s"Treat string as single line.  That is, change \*(L".\*(R" to match any characterwhatsoever, even a newline, which normally it would not match..SpUsed together, as /ms, they let the \*(L".\*(R" match any character whatsoever,while still allowing \*(L"^\*(R" and \*(L"$\*(R" to match, respectively, just afterand just before newlines within the string..IP "i" 4.IX Xref " i regex, case-insensitive regexp, case-insensitive regular expression, case-insensitive".IX Item "i"Do case-insensitive pattern matching..SpIf \f(CW\*(C`use locale\*(C'\fR is in effect, the case map is taken from the currentlocale.  See perllocale..IP "x" 4.IX Xref " x".IX Item "x"Extend your pattern's legibility by permitting whitespace and comments..IP "p" 4.IX Xref " p regex, preserve regexp, preserve".IX Item "p"Preserve the string matched such that ${^PREMATCH}, {$^MATCH}, and${^POSTMATCH} are available for use after matching..IP "g and c" 4.IX Xref " g  c".IX Item "g and c"Global matching, and keep the Current position after failed matching.Unlike i, m, s and x, these two flags affect the way the regex is usedrather than the regex itself. See\&\*(L"Using regular expressions in Perl\*(R" in perlretut for further explanationof the g and c modifiers..PPThese are usually written as "the \f(CW\*(C`/x\*(C'\fR modifier", even though the delimiterin question might not really be a slash.  Any of thesemodifiers may also be embedded within the regular expression itself usingthe \f(CW\*(C`(?...)\*(C'\fR construct.  See below..PPThe \f(CW\*(C`/x\*(C'\fR modifier itself needs a little more explanation.  It tellsthe regular expression parser to ignore whitespace that is neitherbackslashed nor within a character class.  You can use this to break upyour regular expression into (slightly) more readable parts.  The \f(CW\*(C`#\*(C'\fRcharacter is also treated as a metacharacter introducing a comment,just as in ordinary Perl code.  This also means that if you want realwhitespace or \f(CW\*(C`#\*(C'\fR characters in the pattern (outside a characterclass, where they are unaffected by \f(CW\*(C`/x\*(C'\fR), then you'll either have toescape them (using backslashes or \f(CW\*(C`\eQ...\eE\*(C'\fR) or encode them using octalor hex escapes.  Taken together, these features go a long way towardsmaking Perl's regular expressions more readable.  Note that you have tobe careful not to include the pattern delimiter in the comment\*(--perl hasno way of knowing you did not intend to close the pattern early.  Seethe C\-comment deletion code in perlop.  Also note that anything insidea \f(CW\*(C`\eQ...\eE\*(C'\fR stays unaffected by \f(CW\*(C`/x\*(C'\fR..IX Xref " x".Sh "Regular Expressions".IX Subsection "Regular Expressions"\fIMetacharacters\fR.IX Subsection "Metacharacters".PPThe patterns used in Perl pattern matching evolved from the ones supplied inthe Version 8 regex routines.  (The routines are derived(distantly) from Henry Spencer's freely redistributable reimplementationof the V8 routines.)  See \*(L"Version 8 Regular Expressions\*(R" fordetails..PPIn particular the following metacharacters have their standard \fIegrep\fR\-ishmeanings:.IX Xref "metacharacter \e ^ . $ | ( () [ []".PP.Vb 7\&    \e   Quote the next metacharacter\&    ^   Match the beginning of the line\&    .   Match any character (except newline)\&    $   Match the end of the line (or before newline at the end)\&    |   Alternation\&    ()  Grouping\&    []  Character class.Ve.PPBy default, the \*(L"^\*(R" character is guaranteed to match only thebeginning of the string, the \*(L"$\*(R" character only the end (or before thenewline at the end), and Perl does certain optimizations with theassumption that the string contains only one line.  Embedded newlineswill not be matched by \*(L"^\*(R" or \*(L"$\*(R".  You may, however, wish to treat astring as a multi-line buffer, such that the \*(L"^\*(R" will match after anynewline within the string (except if the newline is the last character inthe string), and \*(L"$\*(R" will match before any newline.  At thecost of a little more overhead, you can do this by using the /m modifieron the pattern match operator.  (Older programs did this by setting \f(CW$*\fR,but this practice has been removed in perl 5.9.).IX Xref "^ $  m".PPTo simplify multi-line substitutions, the \*(L".\*(R" character never matches anewline unless you use the \f(CW\*(C`/s\*(C'\fR modifier, which in effect tells Perl to pretendthe string is a single line\*(--even if it isn't..IX Xref ".  s".PP\fIQuantifiers\fR.IX Subsection "Quantifiers".PPThe following standard quantifiers are recognized:.IX Xref "metacharacter quantifier * + ? {n} {n,} {n,m}".PP.Vb 6\&    *      Match 0 or more times\&    +      Match 1 or more times\&    ?      Match 1 or 0 times\&    {n}    Match exactly n times\&    {n,}   Match at least n times\&    {n,m}  Match at least n but not more than m times.Ve.PP(If a curly bracket occurs in any other context, it is treatedas a regular character.  In particular, the lower boundis not optional.)  The \*(L"*\*(R" quantifier is equivalent to \f(CW\*(C`{0,}\*(C'\fR, the \*(L"+\*(R"quantifier to \f(CW\*(C`{1,}\*(C'\fR, and the \*(L"?\*(R" quantifier to \f(CW\*(C`{0,1}\*(C'\fR.  n and m are limitedto integral values less than a preset limit defined when perl is built.This is usually 32766 on the most common platforms.  The actual limit canbe seen in the error message generated by code such as this:.PP.Vb 1\&    $_ **= $_ , / {$_} / for 2 .. 42;.Ve.PPBy default, a quantified subpattern is \*(L"greedy\*(R", that is, it will match asmany times as possible (given a particular starting location) while stillallowing the rest of the pattern to match.  If you want it to match theminimum number of times possible, follow the quantifier with a \*(L"?\*(R".  Notethat the meanings don't change, just the \*(L"greediness\*(R":.IX Xref "metacharacter greedy greediness ? *? +? ?? {n}? {n,}? {n,m}?".PP.Vb 6\&    *?     Match 0 or more times, not greedily\&    +?     Match 1 or more times, not greedily\&    ??     Match 0 or 1 time, not greedily\&    {n}?   Match exactly n times, not greedily\&    {n,}?  Match at least n times, not greedily\&    {n,m}? Match at least n but not more than m times, not greedily.Ve.PP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -