0
Vos RegExps sont fausses !     Simon COURTOIS - @happynoff
^...$
^...$class User < ActiveRecord::Base  attr_accessible :email  validates :email,            presence: true,            uniq...
^...$toto@exemple.fr   ✔totoexemple.fr    ✗hellototo@exemple.fr   ✔hello
^...$
ˆ...$http://ruby-doc.org/core-1.9.3/Regexp.html  Anchors  ^   - Matches beginning of line  $   - Matches end of line
^...$➜ hello➜ totoexemple.fr➜ hello
A...Zhttp://ruby-doc.org/core-1.9.3/Regexp.html  Anchors  ^   - Matches beginning of line  $   - Matches end of line  A - ...
A...Zclass User < ActiveRecord::Base  attr_accessible :email  validates :email,            presence: true,            uniq...
A...Zclass User < ActiveRecord::Base  attr_accessible :email  validates :email,            presence: true,            uniq...
A...Ztoto@exemple.fr   ✔totoexemple.fr    ✗hellototoexemple.fr    ✗hello
A...Z
Merci !Simon COURTOIS - @happynoff
Upcoming SlideShare
Loading in...5
×

Vos Regexps sont fausses !

246

Published on

Je montre ici une simple mesure de sécurité concernant les expressions régulières de validation.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
246
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "Vos Regexps sont fausses !"

    1. 1. Vos RegExps sont fausses ! Simon COURTOIS - @happynoff
    2. 2. ^...$
    3. 3. ^...$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 }endhttp://www.regular-expressions.info/email.html
    4. 4. ^...$toto@exemple.fr ✔totoexemple.fr ✗hellototo@exemple.fr ✔hello
    5. 5. ^...$
    6. 6. ˆ...$http://ruby-doc.org/core-1.9.3/Regexp.html Anchors ^ - Matches beginning of line $ - Matches end of line
    7. 7. ^...$➜ hello➜ totoexemple.fr➜ hello
    8. 8. A...Zhttp://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
    9. 9. A...Zclass 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
    10. 10. A...Zclass 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
    11. 11. A...Ztoto@exemple.fr ✔totoexemple.fr ✗hellototoexemple.fr ✗hello
    12. 12. A...Z
    13. 13. Merci !Simon COURTOIS - @happynoff
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×