View Full Version : Need RegEx for testing for non-null

07-28-2004, 07:33 PM
I've searched all the forums, but can't figure out how to setup a String Comparison in a wizard bean that tests a $W value for a non-null string. I've tried:

and many others. Would appreciate some help. Thanks, Thorne

07-28-2004, 09:44 PM
The expression \Z [The end of the input but for the final terminator, if any] will return true if the value is a null string. So to get a non-null condition, set Evaluate to "Must not be met".

07-29-2004, 09:06 AM
Brian, You've come through again for me. Thanks so much. Thorne

07-29-2004, 09:21 AM
UPDATE - I thought I solved it: .+\Z But, no, that doesn't work. Also, using \Z I get a NullPointerException from the IS bean.

Brian - One problem with this solution... When the string is null, it still seems to satisfy the test and the wizard bean executes. Does that make sense? The string I'm testing is


and String message is set to "" in the Java bean. Thorne

07-29-2004, 10:00 AM
Thorne, if you are using the StringComparisonWizardBeanCondition, you will want to specify only "$W(beanCheckMiddlewarePrereqs.message)" for the Source property. You can't put "trim()" or other java code in the Source property.

07-29-2004, 10:27 AM
Bingo! The problem was my Source expression. Thanks so much, Brian.