简体   繁体   中英

JSP, Spring framework - regular expression form validation

Is there a regular expression that can match 2 fields like:

If I had a password and confirm password field, Is there a regexp that can match the 2 fields before the form is processed?

Why would you want a regex for this? A regex is used to test if some string matches or contains an expression.

To do what you want, just use equals:

if (password.equals(passwordConfirmation)) {
    // proceed
}

It can't be much simpler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM