Upgrade to Pro — share decks privately, control downloads, hide ads and more …

正規表現苦手なんです...

 正規表現苦手なんです...

Regex Festa
https://opt.connpass.com/event/140566/

のLTで使った資料です!

010b92be8b6508ea7da9a0fa5ce3040b?s=128

Nobuyuki Nishiyama

October 18, 2019
Tweet

More Decks by Nobuyuki Nishiyama

Other Decks in Programming

Transcript

  1. 3FHFY'FTUB ਖ਼نදݱۤखͳΜͰ͢ʜ ΅ͬͪήʔϜσϕϩού ੢ࢁ৴ߦɹ

  2. ͸͡Ίʹ ͑Β͍ͱ͜ʹདྷͪ·ͬͨͩʜ

  3. ࠓճͷ͓୊

  4. ਖ਼نදݱͱͷग़ձ͍ ΨϥέʔͷαΠτΛ࡞͍ͬͯΔ࣌ʹ ʮೖྗ͞Εͨจࣈྻ͸ϝʔϧΞυϨε͔ʁʯ Λ൑ఆ͢Δඞཁ͕ੜͨ͡ʂ

  5. ਖ਼نදݱͱͷग़ձ͍ ։ൃݴޠ͸1FSMɻ

  6. ਖ਼نදݱͱͷग़ձ͍ ʮ1FSMϝϞʯͱ͍͏αΠτͰݟͭ ͚ͨʂ IUUQXXXEJOPSKQdPI[BLJQFSMIUN

  7. None
  8. $mail_regex = q{(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\\} . q{\[\]\000-\037\x80-\xff])|"[^\\\\\x80-\xff\n\015"]*(?:\\\\[^\x80-\xff][} . q{^\\\\\x80-\xff\n\015"]*)*")(?:\.(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x} . q{80-\xff]+(?![^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff])|"[^\\\\\x80-} .

    q{\xff\n\015"]*(?:\\\\[^\x80-\xff][^\\\\\x80-\xff\n\015"]*)*"))*@(?:[^(} . q{\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\\\[\]\0} . q{00-\037\x80-\xff])|\[(?:[^\\\\\x80-\xff\n\015\[\]]|\\\\[^\x80-\xff])*} . q{\])(?:\.(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,} . q{;:".\\\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\\\x80-\xff\n\015\[\]]|\\\\[} . q{^\x80-\xff])*\]))*};
  9. Ҿ͍ͨɻ

  10. ٸ͕͹ճΕ

  11. ٸ͕͹ճΕ ࢼߦࡨޡͭͭ͠ɺ )5.-λάͷॻ͖׵͑ͱ͔ɺ จࣈྻஔ׵ͱ͔͕Ͱ͖ΔΑ͏ʹͳͬͨʂ

  12. ָ͘͠ͳ͖ͬͯͨॴͰ ͦͷޙ1FSM͔Β཭Εɺ 0CKFDUJWF$΍$ Ͱॻ͘ɻ

  13. &NBDTͰ࢖͏΋͙͢๨ΕΔʜ

  14. $ ʹͯਖ਼نදݱαϙʔτʂ

  15. ਖ਼نදݱͷ࢓༷͕Θ͔ΒΜʜ

  16. ௐࠪΛଓ͚ͨ݁Ռ &$."4DSJQUͷਖ਼نදݱͷ࢓༷ ͱ΄΅ಉ͡Β͍͠ʜ

  17. &$."4DSJQUͬͯԿʁ

  18. ࠷ۙ+BWB4DSJQUҊ݅Λܦͯ Α͏΍͘ཧղʹࢸͬͨʂ

  19. .%/࠷ߴͰ͢

  20. ࢓༷͸ͳΜͱͳ͘Θ͔ͬͨ

  21. ·ͩ͜ΕΛॻ͚Δؾ͕͠ͳ͍ $mail_regex = q{(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\\} . q{\[\]\000-\037\x80-\xff])|"[^\\\\\x80-\xff\n\015"]*(?:\\\\[^\x80-\xff][} . q{^\\\\\x80-\xff\n\015"]*)*")(?:\.(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x} . q{80-\xff]+(?![^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff])|"[^\\\\\x80-}

    . q{\xff\n\015"]*(?:\\\\[^\x80-\xff][^\\\\\x80-\xff\n\015"]*)*"))*@(?:[^(} . q{\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\\\[\]\0} . q{00-\037\x80-\xff])|\[(?:[^\\\\\x80-\xff\n\015\[\]]|\\\\[^\x80-\xff])*} . q{\])(?:\.(?:[^(\040)<>@,;:".\\\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,} . q{;:".\\\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\\\x80-\xff\n\015\[\]]|\\\\[} . q{^\x80-\xff])*\]))*};
  22. ͱݴ͏༁Ͱʜ ೔ʑͷ܇࿅ํ๏ͱ͔ίπͱ͔ ڭ͍͑ͯͩ͘͞ʂ

  23. w5XJUUFS!NJOHBNF w'BDFCPPLNJOHBNF w(JU)VCUFLOJTIJ ͓͠·͍ ΞϓϦ޷ධ഑৴தʂ