Y
Y
yogev_ezra2013-05-23 13:54:34
Java
yogev_ezra, 2013-05-23 13:54:34

Please help me write a correct regular expression for org.apache.regexp.re

Good afternoon!

A task has been received - to set password requirements in a web application. Requirements are specified through regular expression. I have the code from the web-application itself, but I cannot change it. The field for the regular expression is one and the check occurs once, that is, you cannot check for one expression, and then for another. When looking at the code, it turned out that the class used by this program for regular expression: org.apache.regexp.RE

Requirements are similar to these forums.asp.net/t/918584.aspx/2/10
1) 6-10 characters
2) At least one alpha AND one number
3) The following special chars are allowed (0 or more): [email protected]#$%

I've been suffering for several days now - I just can't compose the expression correctly. The link to the example I gave uses lookahead ('?=' ) - but a Google search for " lookahead org.apache.regexp.RE " returns nothing sane, and a search for " org.apache.regexp.RE at least one letter and digit " - returns nothing at all. When copying the example as is, web-application responds that the regular expression is invalid. You can, of course, compose it by searching through all possible options, but then it will be very long and will not fit into the SQL table where it should be stored.

Is it even possible what I have been asked? Or should the web application developers (that's a different department in our firm) be told to use a different class? Thanks in advance for your replies and advice!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yaroslav Astafiev, 2013-06-18
@yogev_ezra

the example you describe uses lookahead and lookback checks.
lookahead org.apache.regexp.RE - does not support them, you need to write a regular expression bypassing this condition.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question