See Java doc of java.util.regexp.Pattern

A compiled representation of a regular expression.

A regular expression, specified as a string, must first be compiled into an instance of this class. The resulting pattern can then be used to create a |Matcher| object that can match arbitrary _||_character sequences_||_ against the regular expression. All of the state involved in performing a match resides in the matcher, so many matchers can share the same pattern.

A typical invocation sequence is thus

Pattern p = Pattern.|compile|("a*b");
Matcher m = p.|matcher|("aaaaab");
boolean b = m.|matches|();

if b == flase - then it does not match.

You can use above mechanism to check for regexp.

Thanks,
Vijay Venkataraman


Legolas Woodland wrote:

Jitendra Kumar wrote:

I assume you are using form to submit the string.

Are you using commons Validator framework ?? If yes, then in
validator-rules.xml , there is validation of type "url".
Use that. or you can use mask if you want to customize it.

Jitendra


Thank you for your reply.
can you tell me how i can do this in java code ?
for example by creating a regular expression object and .... ?

Thanks


-----Original Message-----
From: Legolas Woodland [mailto:[EMAIL PROTECTED] Sent: 29 March, 2006 2:09 AM
To: Struts Users Mailing List
Subject: How i can check an string to be a correct web site format?


Hi
Thank you for reading my post.
i want to check an string to see whether it is a correct web site name or not. I know that i should use regular expression , but i do not know how i should do this , can some one help me with this ?

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



------------------------------DISCLAIMER------------------------------
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to