• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
    問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
    當前位置: 首頁 - 科技 - 知識百科 - 正文

    perl程序設計技巧

    來源:懂視網 責編:小采 時間:2020-11-09 15:44:45
    文檔

    perl程序設計技巧

    perl程序設計技巧:1. Why does POE pass parameters as array slices http://poe.perl.org/POE_FAQ/calling_convention 2. perl regular expression fast referecnces metacharacters are {}[]() ^ $ . | * + a metacharacter can be matched by putting a backslash befo
    推薦度:
    導讀perl程序設計技巧:1. Why does POE pass parameters as array slices http://poe.perl.org/POE_FAQ/calling_convention 2. perl regular expression fast referecnces metacharacters are {}[]() ^ $ . | * + a metacharacter can be matched by putting a backslash befo

    1. Why does POE pass parameters as array slices? http://poe.perl.org/?POE_FAQ/calling_convention 2. perl regular expression fast referecnces metacharacters are {}[]() ^ $ . | * + ? a metacharacter can be matched by putting a backslash befo

    1. Why does POE pass parameters as array slices?
    http://poe.perl.org/?POE_FAQ/calling_convention

    2. perl regular expression fast referecnces
    metacharacters are

    { } [ ] ( ) ^ $ . | * + ?

    a metacharacter can be matched by putting a backslash before it
    anchor metacharacters ^ and $ .
    The anchor ^ means match at the beginning of the string and the anchor $ means match at the end of the string, or before a newline at the end of the string.

    "housekeeper" =~ /keeper/; # matches
    "housekeeper" =~ /^keeper/; # doesn't match
    "housekeeper" =~ /keeper$/; # matches
    "housekeeper " =~ /keeper$/; # matches

    A character class allows a set of possible characters, rather than just a single character, to match at a particular point in a regexp.Character classes are denoted by brackets [...], with the set of characters to be possiblly matched inside. Some examples:

    /cat/; #matches 'cat'
    /[bcr]at/; #matches 'bat', 'cat', or 'rat'
    /item[0123456789]/; #matches 'item0' or ... or 'item9'
    "abc" =~ /[cab]/; #matches 'a'
    /[yY][eE][sS]/ can be rewritten as /yes/i.

    The 'i' stands for case-insensitive and is an example of a modifier of the matching operation.
    The special characters for a character class are - ] / ^ $ (and the pattern delimiter, whatever it is). ] is special because it denotes the end of a character class. $ is special because it denotes a scalar variable. / is special because it is used in escape sequences.

    /[/]c]def/; # matches ']def' or 'cdef'
    $x = 'bcr';
    /[$x]at/; # matches 'bat', 'cat', or 'rat'
    /[/$x]at/; # matches '$at' or 'xat'
    /[//$x]at/; # matches '/at', 'bat, 'cat', or 'rat'

    The specia character '-' acts as a range operator within a character class.

    /item[0-9]/; # matches 'item0' or ... or 'item9'
    /[0-9bx-z]aa/; # matches '0aa', ..., '9aa',
    # 'baa', 'xaa', 'yaa', or 'zaa'
    /[0-9a-fA-F]/; # matches a hexadecimal digit
    /[0-9a-zA-Z_]/; # matches a "word" character,
    # like those in a Perl variable name

    If '-' is the first or last character in a character class, it is treated as an ordinary character; [-ab], [ab-] and [a/-b] are all equivalent.
    The special character ^ in the first position of a character class denotes a negated character class, which matches any characters but those in the brackets.

    /[^a]at/; # doesn't match 'aat' or 'at', but matches
    # all other 'bat', 'cat, '0at', '%at', etc.
    /[^0-9]/; # matches a non-numeric character
    /[a^]at/; # matches 'aat' or '^at'; here '^' is ordinary

    /d matches a digit, not just [0-9] but also digits from non-roman scripts
    /s matches a whitespace character, the set [/ /t/r/n/f] and others
    /w matches a word character (alphanumeric or _), not just [0-9a-zA-Z_] but also digits and
    characters from non-roman scripts
    /D is a negated /d; it represents any other character than a digit, or [^/d]
    /S is a negated /s; it represents any non-whitespace character [^/s]
    /W is a negated /w; it represents any non-word character [^/w]
    The period '.' matches any character but "/n" (unless the modifier //s is in effect, as explained
    below).

    //d/d:/d/d:/d/d/; # matches a hh:mm:ss time format
    /[/d/s]/; # matches any digit or whitespace character
    //w/W/w/; # matches a word char, followed by a
    # non-word char, followed by a word char
    /..rt/; # matches any two chars, followed by 'rt'
    /end/./; # matches 'end.'
    /end[.]/; # same thing, matches 'end.'

    The alternation metacharacter | .To match dog or cat, we form the
    regexp dog|cat. As before, Perl will try to match the regexp at the earliest possible point in the
    string. At each character position, Perl will first try to match the first alternative, dog. If dog doesn't
    match, Perl will then try the next alternative, cat. If cat doesn't match either, then the match fails and
    Perl moves to the next position in the string.

    "cats and dogs" =~ /cat|dog|bird/; # matches "cat"
    "cats and dogs" =~ /dog|cat|bird/; # matches "cat"

    () is grouping metacharacter.

    /(a|b)b/; # matches 'ab' or 'bb'
    /(ac|b)b/; # matches 'acb' or 'bb'
    /(^a|b)c/; # matches 'ac' at start of string or 'bc' anywhere
    /(a|[bc])d/; # matches 'ad', 'bd', or 'cd'
    /house(cat|)/; # matches either 'housecat' or 'house'
    /house(cat(s|)|)/; # matches either 'housecats' or 'housecat' or
    # 'house'. Note groups can be nested.
    /(19|20|)/d/d/; # match years 19xx, 20xx, or the Y2K problem, xx
    "20" =~ /(19|20|)/d/d/; # matches the null alternative '()dd',
    # because '20dd' can't match

    聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

    perl程序設計技巧

    perl程序設計技巧:1. Why does POE pass parameters as array slices http://poe.perl.org/POE_FAQ/calling_convention 2. perl regular expression fast referecnces metacharacters are {}[]() ^ $ . | * + a metacharacter can be matched by putting a backslash befo
    推薦度:
    標簽: 技巧 設計 程序
    • 熱門焦點

    最新推薦

    猜你喜歡

    熱門推薦

    專題
    Top
    主站蜘蛛池模板: 国产成人精品日本亚洲直接| 久久精品一区二区国产| 99精品一区二区三区无码吞精| 国产乱人伦偷精品视频| 久久精品国产网红主播| 久久99精品九九九久久婷婷| 精品免费tv久久久久久久| 日本伊人精品一区二区三区| 国产亚洲精品不卡在线| 国产原创精品视频| 久久免费的精品国产V∧| 日本午夜精品理论片A级APP发布| 四虎精品影院4hutv四虎| 国产精品vⅰdeoxxxx国产| 中文字幕无码久久精品青草| 国产精品网址在线观看你懂的| 国产精品视频一区二区三区经| 日韩人妻无码精品久久免费一| 欧美日韩国产精品自在自线| 国产精品久久久久久久午夜片| 精品国产自在在线在线观看| 91精品成人免费国产| 九九精品99久久久香蕉| 亚洲精品无码不卡在线播放HE| 色婷婷久久久SWAG精品| 久草热8精品视频在线观看| 99久久婷婷国产综合精品草原| 国产精品视频久久| 2022精品天堂在线视频| 国产色婷婷精品综合在线| 亚洲日韩国产精品乱| 青青青青久久精品国产h| 国产91大片精品一区在线观看| 色妞ww精品视频7777| 亚洲精品制服丝袜四区| 中文字幕精品一区| 亚洲精品无码专区久久久| 亚洲线精品一区二区三区 | 午夜DY888国产精品影院| 一本之道av不卡精品| 亚洲精品国自产拍在线观看|