rubyinside.comã« 21 Ruby Tricks You Should Be Using In Your Own Codeã¨ããè¨äºãæ²è¼ããã¦ãã¾ããã ããRubyã³ã¼ããã·ã³ãã«ã«èªã¿ãããããããã«è¦ãã¦ããã¦æã¯ãªãã§ããã åå¼·ã«ãªãã¾ããã®ã§æ訳ãã¾ããã 1 - æ£è¦è¡¨ç¾ã«ãããããæåãæãåºãç°¡åãªæ¹æ³ æååããæ£è¦è¡¨ç¾ã«ãããããæåãæãåºãå ´åãé常ã¯matchãã½ããã使ãã¾ããã次ã®ãããªã·ã§ã¼ãã«ããæ¹æ³ãããã¾ãã email = "Fred Bloggs <fred@bloggs.com>"email.match(/<(.*?)>/)[1] # => âfred@bloggs.comâemail[/<(.*?)>/, 1] # => âfred@bloggs.comâemail.match(/(x)/)[1] # => NoMethodEr
{{#tags}}- {{label}}
{{/tags}}