Re: Regular Expression with Variables.

2016-05-19 Thread Arun S
Yes, This works exactly how i intended to. The Validator Raises error when it does'nt match now. And i did eliminate the .*$ which dint make much of a difference. Thanks for the help. Cheers Arun. On Thursday, May 19, 2016 at 12:35:42 PM UTC+5:30, Stephen Butler wrote: > > You can't provide

Re: Regular Expression with Variables.

2016-05-19 Thread Stephen J. Butler
You can't provide multiple regex's to the RegexField. What you were doing before is exactly equivalent to this: r'^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!$%^&*?@#-_+=]).*$' So for my suggestion, just do this:

Re: Regular Expression with Variables.

2016-05-19 Thread Arun S
I Did try this, i think i am not doing it right: Could you tell what is that i am doing is wrong. I am now not able to provide multiple Regex in the forms.RegexField using the above method. regex_f=r'^.*(?=.{{{MIN},{MAX}}})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!$%^&*?@#-_+=])'

Re: Regular Expression with Variables.

2016-05-18 Thread Stephen J. Butler
I think I'd just use format() on the regex, being careful to escape '{' and '}': regex_f=r'^.*(?=.*{{{MIN},{MAX}}}*)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!$%^ &*?@#-_+=])' regex=regex_f.format(MIN=settings.MY_RE_MIN, MAX=settings.MY_RE_MAX) On Thu, May 19, 2016 at 12:37 AM, Arun S

Regular Expression with Variables.

2016-05-18 Thread Arun S
Hi, I have a Regular Expression something like this: regex=r'^.*(?=.*{8,}*)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!$%^&*?@#-_+=])' r'.*$', In this, i would like to read the values from the Django Setting file on the Max and Min Length and provide them as my input instead of Hard