Download - Vos Regexps sont fausses !
![Page 1: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/1.jpg)
V! R"#$p% %&'( f)*%%"% !S+,&' COURTOIS - @-)pp.'&/
![Page 2: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/2.jpg)
^...$
![Page 3: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/3.jpg)
^...$
class User < ActiveRecord::Base attr_accessible :email
validates :email, presence: true, uniqueness: true, format: { with: / /i }end
http://www.regular-expressions.info/email.html
^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$
![Page 4: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/4.jpg)
^...$
✗totoexemple.fr
✔
![Page 5: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/5.jpg)
^...$
![Page 6: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/6.jpg)
ˆ...$
http://ruby-doc.org/core-1.9.3/Regexp.html
Anchors
^ - Matches beginning of line$ - Matches end of line
![Page 8: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/8.jpg)
\A...\Z
http://ruby-doc.org/core-1.9.3/Regexp.html
Anchors
^ - Matches beginning of line$ - Matches end of line\A - Matches beginning of string\Z - Matches end of string
![Page 9: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/9.jpg)
\A...\Z
class User < ActiveRecord::Base attr_accessible :email
validates :email, presence: true, uniqueness: true, format: { with: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i }end
![Page 10: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/10.jpg)
\A...\Z
class User < ActiveRecord::Base attr_accessible :email
validates :email, presence: true, uniqueness: true, format: { with: /\A[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\Z/i }end
![Page 11: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/11.jpg)
\A...\Z
✗totoexemple.fr
hellototoexemple.frhello
✗
![Page 12: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/12.jpg)
\A...\Z
![Page 13: Vos Regexps sont fausses !](https://reader033.vdocuments.pub/reader033/viewer/2022061214/549a4dd9ac7959ff2d8b5aa9/html5/thumbnails/13.jpg)
M"r0+ !S+,&' COURTOIS - @-)pp.'&/