Perl Best Practices [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Perl Best Practices [Electronic resources] - نسخه متنی

Damian Conway

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید







B.11. Chapter 12, Regular Expressions


  • Always use the /x flag. [Extended Formatting ]

  • Always use the /m flag. [Line Boundaries ]

  • Use \A and \z as string boundary anchors. [String Boundaries ]

  • Use \z, not \Z, to indicate "end of string". [End of String ]

  • Always use the /s flag. [Matching Anything ]

  • Consider mandating the Regexp::Autoflags module. [Lazy Flags ]

  • Use m{...} in preference to /.../ in multiline regexes. [Brace Delimiters ]

  • Don't use any delimiters other than /.../ or m{...}. [Other Delimiters ]

  • Prefer singular character classes to escaped metacharacters. [Metacharacters ]

  • Prefer named characters to escaped metacharacters. [Named Characters ]

  • Prefer properties to enumerated character classes. [Properties ]

  • Consider matching arbitrary whitespace, rather than specific whitespace characters. [Whitespace ]

  • Be specific when matching "as much as possible". [Unconstrained Repetitions ]

  • Use capturing parentheses only when you intend to capture. [Capturing Parentheses ]

  • Use the numeric capture variables only when you're sure that the preceding match succeeded. [Captured Values ]

  • Always give captured substrings proper names. [Capture Variables ]

  • Tokenize input using the /gc flag. [Piecewise Matching ]

  • Build regular expressions from tables. [Tabular Regexes ]

  • Build complex regular expressions from simpler pieces. [Constructing Regexes ]

  • Consider using Regexp::Common instead of writing your own regexes. [Canned Regexes ]

  • Always use character classes instead of single-character alternations. [Alternations ]

  • Factor out common affixes from alternations. [Factoring Alternations ]

  • Prevent useless backtracking. [Backtracking ]

  • Prefer fixed-string eq comparisons to fixed-pattern regex matches. [String Comparisons ]



/ 317