Vos Regexps sont fausses !

  • 214 views
Uploaded on

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

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

More in: Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
214
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
3
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    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

  • 1. Vos RegExps sont fausses ! Simon COURTOIS - @happynoff
  • 2. ^...$
  • 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. ^...$toto@exemple.fr ✔totoexemple.fr ✗hellototo@exemple.fr ✔hello
  • 5. ^...$
  • 6. ˆ...$http://ruby-doc.org/core-1.9.3/Regexp.html Anchors ^ - Matches beginning of line $ - Matches end of line
  • 7. ^...$➜ hello➜ totoexemple.fr➜ hello
  • 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. 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. 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. A...Ztoto@exemple.fr ✔totoexemple.fr ✗hellototoexemple.fr ✗hello
  • 12. A...Z
  • 13. Merci !Simon COURTOIS - @happynoff