[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

reg ex til validering af password - kan det gøres kortere?



jeg roder med nogen reg ex til at validere et nyvalgt kodeord. altså ikke til at teste om kodeordet matcher til autentikering, men for at lave restriktioner for hvad der må vælges som kodeord.

kravene er:

præcis 6 tegn
mindst et tal
mindst et bostav
kun [A-Za-z0-9] kan indgå.
(blandt andet for at undgå problemer med æøå mm som kan have forskellige længder i forskellige encodings)


Jeg kan lave testen ved at matche mod tre regulære udtryk i ruby:

pass =~ /^[A-Za-z0-9]{6}$/    #6 tegn og kun [A-Za-z0-9]
pass =~ /\d/                  #mindst et tal
pass =~ /\w/                  #mindst et bogstav

kan det reduceres til et eller evt to regulære udtryk? det er begrænset hvad man kan lave af betingelser i reg ex, ikke?

- siemen

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2007-01-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *