Save 37% off PRO during our Black Friday Sale! »

まだ正規表現で消耗してるの? / PHP Conference Fukuoka 2016

まだ正規表現で消耗してるの? / PHP Conference Fukuoka 2016

PHPカンファレンス福岡2016のLTスライドです

C4c161ae9eeeed8f161197410f7a228a?s=128

Kenichiro Kishida

May 29, 2016
Tweet

Transcript

  1. · ͩ ਖ਼ ن ද ݱ Ͱ ফ ໣ ͠

    ͯ Δ ͷ ʁ Մ ಡ ੑ Λ ্ ͛ Δ ͱ ͏ · ͘ ͍ ͘ ͠ ͣ ͻ ͜ 1)1ΧϯϑΝϨϯε෱Ԭ ෳࡶͳਖ਼نදݱΛߟ͑Δͷ͸࣌ؒͷແବͩͬͨ ౦ ژ
  2. ,FOJDIJSP,JTIJEB 5PLZP +"1"/ TJ[VIJLP!HNBJMDPN !TJ[VIJLP IUUQTHJUIVCDPNTJ[VIJLP IUUQCMPHPQFOUPLZPKQ R: HmM^JRTIeUY

  3. I — ਖ਼نදݱ

  4. /(?:(?P<dayOfWeek>(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)|(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))? (?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)|(?:(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?: [\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]| [\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n)) (?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))?(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)(?:(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+ (?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]| [\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n)) (?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+) +)))?)),)?(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:\d){1,2}(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)|(?:(?: (?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?

    (?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t]) +(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))? (?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))?(?:\d){1,2}(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?: \n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]| [\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?: [\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(?:(?:(?:(?:(?:[\x20\t]) +(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:\d)(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)|(?:(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r \n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]| [\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?: [\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?: [\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))?(?:\d)(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?: [\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]| [\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?: \n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+) (?:(?:\d){2,2}|(?:(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n)) (?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+ (?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+ (?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))?(?:\d){2,2}(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?: (?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0| (?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?: [\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))\:(?:(?:\d){2,2}|(?:(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?: [\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93- \d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?: [\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?: \n)|(?:\r\n))(?:[\x20\t])+)+)))?(?:\d){2,2}(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?: [\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]| [\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n)) (?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))(?:\:(?:(?:\d){2,2}|(?:(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n)) (?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]| [\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))? \)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))?(?:\d){2,2}(?:(?:(?:(?: (?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?: [\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?: (?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?: [\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))))?(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)(?:\+|\-)(?:\d){4,4}|(?:UT|GMT|EST|EDT|CST|CDT|MST| MDT|PST|PDT|[\d65-\d73]|[\d75-\d90]|[\d97-\d105]|[\d107-\d122]))(?:(?:(?:(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?P<comment>\((?:(?:(?:(?:(?:[\x20\t])+(?: (?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?(?:(?:[\d33-\d39]|[\d42-\d91]|[\d93-\d126]|(?:[\d1-\d8]|[\d11]|[\d12]|[\d14-\d31]|[\d127]))|(?:\\(?:[\x21-\x7E]|[\x20\t])|\\(?:\d0|(?:[\d1-\d8]| [\d11]|[\d12]|[\d14-\d31]|[\d127])|\n|\r))|(?P>comment)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?\)))+(?:(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?: [\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+))?|(?:(?:(?:[\x20\t])+(?:(?:\n)|(?:\r\n)))?(?:[\x20\t])+|(?:[\x20\t])+(?:(?:(?:\n)|(?:\r\n))(?:[\x20\t])+)+)))?$/
  5. None
  6. RFC5322 Internet Message Format Date and Time Specification

  7. /^(?P<scheme>[a-zA-Z](?:[a-zA-Z0-9\+\-\.])*)\:(?P<hierPart>(?:\/\/(? P<authority>(?:(?P<userinfo>(?:(?:[a-zA-Z0-9\-\._~]|%(?:[0-9A-Z]){2}| [\!\$&'\(\)\*\+,;\=]|\:))*)@)?(?P<host>(?:(?:0-9|1-90-9|10-90-9|20-40-9| 250-5)\.(?:0-9|1-90-9|10-90-9|20-40-9|250-5)\.(?:0-9|1-90-9|10-90-9| 20-40-9|250-5)\.(?:0-9|1-90-9|10-90-9|20-40-9|250-5)|(?:(?:[a-zA- Z0-9\-\._~]|%(?:[0-9A-Z]){2}|[\!\$&'\(\)\*\+,;\=]))+))(?:\:(?P<port>(?:\d) +))?)(?P<pathAbempty>(?:\/(?:(?:[a-zA-Z0-9\-\._~]|%(?:[0-9A-Z]){2}|[\! \$&'\(\)\*\+,;\=]|\:|@))*)*)|(?P<pathAbsolute>\/(?:(?:(?:[a-zA-Z0-9\- \._~]|%(?:[0-9A-Z]){2}|[\!\$&'\(\)\*\+,;\=]|\:|@))+(?:\/(?:(?:[a-zA-Z0-9\- \._~]|%(?:[0-9A-Z]){2}|[\!\$&'\(\)\*\+,;\=]|\:|@))*)+)?)|(?

    P<pathRootless>(?:(?:[a-zA-Z0-9\-\._~]|%(?:[0-9A-Z]){2}|[\!\$&'\(\)\*\ +,;\=]|\:|@))+(?:\/(?:(?:[a-zA-Z0-9\-\._~]|%(?:[0-9A-Z]){2}|[\!\$&'\(\)\*\ +,;\=]|\:|@))*)*)|(?P<pathEmpty>^(?:[a-zA-Z0-9\-\._~]|%(?:[0-9A-Z]) {2}|[\!\$&'\(\)\*\+,;\=]|\:|@))))(?:\?(?P<query>(?:(?:(?:[a-zA-Z0-9\-\._~]| %(?:[0-9A-Z]){2}|[\!\$&'\(\)\*\+,;\=]|\:|@)|\/|\?))*))?(?:#(?P<fragment>(?: (?:(?:[a-zA-Z0-9\-\._~]|%(?:[0-9A-Z]){2}|[\!\$&'\(\)\*\+,;\=]|\:|@)|\/| \?))*))?$/
  8. RFC3986 Uniform Resource Identifier (URI): Generic Syntax

  9. URI = scheme ":" hier-part [ "?" query ] [

    "#" fragment ] scheme = ALPHA * ( ALPHA / DIGIT / "+" / "-" / "." ) hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty https://www.ietf.org/rfc/rfc3986.txt
  10. wݕࡧͨ݁͠Ռɺग़͖ͯͨਖ਼نදݱΛί ϐϖͯ͠·ͤΜ͔ʁͦΕਖ਼͍͠Ͱ͔͢ʁ wଞͷਓ͕ॻ͍ͨਖ਼نදݱΛؚΉίʔυ ΛϨϏϡʔͰ͖·͔͢ʁ wޙͰͦͷਖ਼نදݱϝϯςͰ͖·͔͢ʁ

  11. ΋ͬͱ؆୯ʹ ॻ͖͍ͨPSಡΈ͍ͨ ͱࢥͬͨ͜ͱ͸ͳ͍Ͱ͔͢ʁ

  12. None
  13. Regular Expressions made easy

  14. $regex = new VerbalExpressions; $regex->startOfLine() ->then("http") ->maybe("s") ->then("://") ->maybe("www.") ->anythingBut("

    ") ->endOfLine(); /^(?:http)(?:s)?(?:\:\/\/)(?:www\.)?(?:[^ ]*)$/m
  15. $rfc3986 = new VerbalExpressions; // scheme $scheme = new VerbalExpressions;

    $scheme->add("http")->maybe("s") ->_or("ftp"); $rfc3986->startOfLine() ->add($scheme) ->add("://"); /^(?:\(\?\:http\)\(\?\:s\)\?\)\|\(\?\:ftp)(?:\:\/\/)/m
  16. w⾭ଟ͘ͷݴޠʹରԠ͍ͯ͠Δ w⾭؆୯ʹॻ͚Δ w⾪ෳࡶͳέʔε͸ॻ͚ͳ͍ w⾪ݴޠʹΑ࣮ͬͯ૷͕ϚνϚν

  17. None
  18. None
  19. None
  20. http://www.kurtisrainboltgreene.name/hexpress/

  21. The hexpress gem is another take at the concept of

    "Verbal Hexpressions" in Ruby.
  22. pattern = Hexpress.new. start("http"). maybe("s"). with("://"). maybe { words.with(".") }.

    find { matching { [word, "-"] }.multiple }. has("."). either("com", "org"). maybe("/"). ending
  23. ϫλγϋϧϏʔνϣοτ

  24. To PHP https://github.com/sizuhiko/hexpress

  25. trait Find { public function find($value = null, $named =

    false) { $param = compact('value', 'named'); return is_callable($value) ? $this->addNested(FindValue::class, $param) : $this->addValue(FindValue::class, $param); } public function capture($value = null) { return $this->find($value); } } class FindValue { use Nested; private $hexpression; private $open; private $close; public function __construct($param) { extract($param); $this->hexpression = is_callable($value) ? new Hexpress($value) : $value; $this->open = $named ? "(?P<{$named}>" : '('; $this->close = ')'; } } class Hexpress def find(value = nil, &block) value ? add_value(Nested::Find, value) : add_nested(Nested::Find, &block) end alias_method :capture, :find module Nested class Find include Nested def initialize(value=nil,&block) @hexpression = value || Hexpress.new.instance_eval(&block) @open, @close = "(", ")" end end end end ࠷ۙͷ1)1ͳΒ͔ͳΓ஧࣮ʹҠ২Մೳ
  26. URI = scheme ":" hier-part [ "?" query ] [

    "#" fragment ] scheme = ALPHA * ( ALPHA / DIGIT / "+" / "-" / "." ) hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty https://www.ietf.org/rfc/rfc3986.txt
  27. $this->hexpress ->start($this->scheme()) ->with(':') ->has($this->hierPart()) ->maybe($this->query()) ->maybe($this->fragment()) ->end(); URI = scheme

    ":" hier-part [ "?" query ] [ "#" fragment ]
  28. private function scheme() { return (new Hexpress()) ->find(function ($hex) {

    $hex->matching(function ($hex) { $hex->letter(); }); $hex->many(function ($hex) { $hex->matching(function ($hex) { $hex->letter()->number()->with('+-.'); }); }, 0); }, 'scheme'); } scheme = ALPHA * ( ALPHA / DIGIT / "+" / "-" / "." ) ̍ ̍    
  29. 1)1൛ͷಠࣗػೳ ໊લ෇͖αϒύλʔϯ

  30. private function scheme() { return (new Hexpress()) ->find(function ($hex) {

    $hex->matching(function ($hex) { $hex->letter(); }); $hex->many(function ($hex) { $hex->matching(function ($hex) { $hex->letter()->number()->with('+-.'); }); }, 0); }, 'scheme'); } scheme = ALPHA * ( ALPHA / DIGIT / "+" / "-" / "." ) pOEϝιουͷୈೋҾ਺ʹ αϒύλʔϯͷ໊લΛࢦఆͰ͖Δ
  31. preg_match( 'http://example.com:80/', $pattern->toRegExp(), $matches); echo $matches['scheme']; #=> 'http'

  32. w΋͏ਖ਼نදݱͳΜ͔Ͱফ໣͠ͳ͍ʂ w3VCZͷΤίγεςϜ͔ΒͷҠ২΋༰қ ʹͳ͍ͬͯΔʂʂ wఘΊͳ͍Ͱʂʂʂ

  33. WJTJUNZCMPHHJUIVC https://github.com/sizuhiko http://blog.open.tokyo.jp R: HmM^JRTIeUY @sizuhiko #phpstudy 2016/3/30