Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 455
Registered: ‎01-14-2009
My Device: Apple iPhone 3GS 16GB

regular expression on customtextfield

Hello friends

 

I have a custom text field, in my app

 

Is there any simple way i can check regular expressions against the text in the text field. I want to check the following regular expression  for email validation

 

Regex: ^([a-z0-9\+_\-]+)(\.[a-z0-
9\+_\-]+)*@([a-z0-9\-]+\.)+[az]{
2,6}$

 

something like this

 

RE r = new RE("abc(\\w*)");            // Create new pattern
if (r.match("abcdefg"))                // Match pattern
   
System.out.println("Match found");
Trusted Contributor
Posts: 176
Registered: ‎04-12-2012
My Device: Bold 9780 & Curve 8250
My Carrier: vodacom

Re: regular expression on customtextfield

hello 

 

Ever found theanswer to your question???

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: regular expression on customtextfield

I have downloaded a 3rd party source to provide regular expression support.  I can't actually remember where I got it from but it is called RE, and the comments indicate the authers are:

 

 * @author <a href="mailto:jonl@muppetlabs.com">Jonathan Locke</a>
 * @author <a href="mailto:ts@sch-fer.de">Tobias Sch&auml;fer</a>

 

It is available under the Apache license. 

Trusted Contributor
Posts: 176
Registered: ‎04-12-2012
My Device: Bold 9780 & Curve 8250
My Carrier: vodacom

Re: regular expression on customtextfield

Thank you Peter

 

 Will go and take a loook at it

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: regular expression on customtextfield