Thanks Dave,

In order to dispaly the error message if we give the whitespace infront of
the number , we need to set trim="false".

I sloved this problem by setting trim="false" for regex validation. Below is
the snippet.

Thanks a lot for you input.

<field name="caseNumber">
        <field-validator type="requiredstring">
                <message key="initializeCase.caseNumber.required"/>
        </field-validator>
        <field-validator type="regex">
                false
                [0-9]{1,}               
                 <message key="invalid.fieldvalue.caseNumber"/>
        </field-validator>      
</field>

Regards
Siddiq.


newton.dave wrote:
> 
> Siddiq Syed wrote:
>> I am searching for the regular expression, which ignore white spaces but
>> no
>> sucess so far.
>> 
>> Any idea ?
> 
> ...
> 
> According to [1] (which was the top hit when I searched for "java 
> +regular expression), "\s" matches any whitespace character. "*" means 0 
> or more occurrences. So \s* would match any number of whitespace 
> characters. This, of course, isn't a Struts issue.
> 
> When I did the afore-mentioned search it returned *many* Java regular 
> expression tutorials; I am skeptical that none of them contained this 
> information.
> 
> You may wish to read [2], which is Sun's regex tutorial. It was among 
> the top-most hits when searching. It included this information.
> 
> Dave
> 
> [1] http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
> [2] http://java.sun.com/docs/books/tutorial/essential/regex/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Trim-for-regex-validator-is-not-working-tp23528434p23602881.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to