I think that may break the regex parsing in MatchPattern() in
CustomField_Overlay.pm. Unless you are talking about doing something
like:
(?#Year)^[12]\d{3}$
becomes
(?#Year)(^[12]\d{3}$)?
Give it a try and let me know how that works for you :-)
Eric Schultz
United Online
-----Original Message-----
From: Todd Chapman [mailto:[EMAIL PROTECTED]
Sent: Monday, June 26, 2006 8:48 AM
To: Schultz, Eric
Cc: Nick Metrowsky; [email protected]
Subject: Re: [rt-users] Regular Expressions for Custom Field Validation
in RT3.6.0
On Mon, Jun 26, 2006 at 08:22:46AM -0700, Schultz, Eric wrote:
> I know what you mean, and I did something like that in my code that I
> backported from 3.5.x to 3.4.x. I added another regex field that said
> whether something was mandatory or not, where 1 is mandatory, and 0 is
> not:
>
> (?#Year)(?#0)^[12]\d{3}$ year, not mandatory
> (?#Mandatory)(?#1). anything, mandatory
> (?#postal code)(?#1)^[A-Z]{2}$ postal code, mandatory
>
> The second one is useful for a field where you want anything, don't
care
> how long or what it looks like, so long is it isn't left blank.
> Obviously, I hacked on the RT code a little that reads this stuff to
> accomodate for the second regex group.
>
> Eric Schultz
> United Online
Eric,
Why add the second regex group when you can wrap the whole
thing in ()? ?
-Todd
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
We're hiring! Come hack Perl for Best Practical:
http://bestpractical.com/about/jobs.html