Skip to content

Commit

Permalink
resolved the bug in username validation
Browse files Browse the repository at this point in the history
  • Loading branch information
MettaSurendhar committed Apr 13, 2023
1 parent 1d90a88 commit 43b482d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
Binary file modified bin/com/menu_driven/proj/Validation.class
Binary file not shown.
Binary file modified bin/com/menu_driven/proj/View.class
Binary file not shown.
2 changes: 1 addition & 1 deletion src/com/menu_driven/proj/Validation.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static boolean UserName(String val) {
return false;
}

String strUserNameRegex = "^([A-Za-z]|[_A-Za-z](?:[_A-Za-z0-9-]+)){7,}$" ; // -> regular expression
String strUserNameRegex = "^([A-Za-z]|[_A-Za-z0-9](?:[_A-Za-z0-9-]*)*){7,}$" ; // -> regular expression
Pattern pattern = Pattern.compile(strUserNameRegex); // -> to generate the pattern from the regular expression
Matcher m = pattern.matcher(strUserName); // -> match the value with the pattern
return m.matches(); // -> returns true if matched or false if not
Expand Down
5 changes: 3 additions & 2 deletions src/com/menu_driven/proj/View.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static void main(String[] args){

objReg.registPost();
if(boolRemindMe != true) {
System.out.println("\n (( TURN ON THE REMIND ME (OPTION 3) IF NEEDED )) \n");
System.out.println("\n\t(( TURN ON THE REMIND ME (OPTION 3) IF NEEDED )) \n");
}
break;

Expand Down Expand Up @@ -282,7 +282,8 @@ public static void main(String[] args){
break;

default :
System.out.println("\n ************ | ENTER A VALID OPTION BETWEEN 1 AND 4 | ************ \n");
System.out.println("\n ************ | ENTER A VALID OPTION BETWEEN 1 AND 4 | ************ \n"
+ "\n -----------------------------------------------\n");
break;

}
Expand Down

0 comments on commit 43b482d

Please sign in to comment.