text: I don't happen to have any sample code that does exactly what you're doing,
  but off the top of my head (with a little help from sun's javadoc) I'd say
  it's something like:
  import java.lang.reflect.Field;
  String stateCode = "AK";
  Class constantClass = Class.forName("com.yourdomain.yourapp.Constants");
  Field stateField = constantClass.getDeclaredField(stateCode);
  String stateRegExp = (String) stateField.get(constantClass);
  System.err.println("regexp for "+stateCode+": "+stateRegExp);
  I don't really know any more about reflection than you, I just followed the
  trail from java.lang.Class to java.lang.reflect.Field. Once you've done it
  once, you see it's no mystery-- you're just doing runtime compiling.
  HTH-- This is just how I'd start, as I haven't tested or used this code. If
  I'm wrong, I'm sure you can figure out what I missed by studying the API
  docs. If, on the other hand, you don't like reading javadocs and generating
  your own test cases, LOL!
  -JT
  -----Original Message-----
  From: Jerry Jalenak [mailto:Jerry.Jalenak@LABONE.com]
  Sent: Monday, September 30, 2002 8:05 AM
  To: 'Struts Users Mailing List'
  Subject: RE: [OT - Java] How can I do this in Java?
  Jason,
  Thanks for the quick reply. I just took at look at the API's, but don't yet
  understand enough about reflection to know how to implement it. Just
  looking at the methods I don't see a way to do what I want - any chance that
  you'd have some sample code laying about?
  Jerry
  > -----Original Message-----
  > From: Taylor, Jason [mailto:jtaylor@cobaltgroup.com]
  > Sent: Monday, September 30, 2002 9:59 AM
  > To: 'Struts Users Mailing List'
  > Subject: RE: [OT - Java] How can I do this in Java?
  >
  >
  > sounds like a job for reflection (java.lang.reflect.*;) Have
  > you looked at
  > java.lang.Class and java.lang.reflect.Field?
  >
  > -----Original Message-----
  > From: Jerry Jalenak [mailto:Jerry.Jalenak@LABONE.com]
  > Sent: Monday, September 30, 2002 7:50 AM
  > To: 'struts-user@jakarta.apache.org'
  > Subject: [OT - Java] How can I do this in Java?
  >
  >
  > OK - off topic, but Sun's java forum sucks, and there are an
  > incredible
  > number of Java guru's on this list, so I thought I'd throw
  > this out here.
  > (That and I am using this in a custom validation routine
  > :-)) Any help
  > would be GREATLY appreciated!
  >
  > Here's the scenario - I've got a series of static constants
  > that represent
  > Java regular expressions. These RE's are used to validate
  > driver license
  > formats for the 50 states + DC. The strings look like this:
  >
  > public static final String AK = "^[0-9]{1,7}$";
  > public static final String AL = "^[0-9]{7}$";
  > public static final String AR = "^[0-9]{8,9}$";
  > public static final String AZ =
  > "^[0-9ABDY][0-9]{8}$|^[A-Z][0-9]{3,6}$|^[A-Z]{2}[0-9]{3,5}$";
  > public static final String CA = "^[A-Z][0-9]{4,7}$";
  > public static final String CO =
  > "^[A-Z][0-9]{1,6}$|^[A-Z]{2}[0-9]{1,6}$|^[0-9]{9}$";
  > etc. etc. etc.
  >
  > On my form I have a drop-down box of states, and a field for
  > the license
  > number. In my custom validator routine, I pick up the value
  > of the state,
  > and build a string to represent the constant - i.e.
  >
  > private static boolean validateDriversLicenseNumber(String
  > licenseState, String licenseNumber)
  > {
  > String licenseConstant = "Constants." + licenseState;
  >
  > I then want to use "licenseConstant" in a Pattern / Match:
  >
  > Pattern p = Pattern.compile(licenseConstant,
  > Pattern.CASE_INSENSITIVE);
  > Match m = p.matcher(licenseNumber);
  > return (m.find());
  > }
  >
  > Obviously the line "String licenseConstant = "Constants." +
  > licenseState;"
  > does not give me the value of Constant.<state name>; the
  > question I have is,
  > is there a method (or something) that will allow me to build
  > such a string,
  > and return the value (i.e. the regular expression)? Or is
  > there a better
  > way of doing this?
  >
  >>