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
Developer
dn8
Posts: 46
Registered: ‎06-16-2009
My Device: Not Specified
Accepted Solution

No Regex?

Ok so after poking around looking for Regex support on BlackBerry I've come across the Pattern Repository... I don't get it! It appears to me that with this repository you are adding match patterns so that the OS can recognize them??

How do I use these in my code?

 

All I want to do is perform simple regex matches and replaces so that I may format phone numbers...

 

I get a phone number like this.

 

String PhoneNum = "17775551212"; or  "91 7775551212" or "<Joe Blow 917775551212>" etc.

 

// Perform Regex

 

Output: 91-777-555-1212

 

right now I am using IndexOf(), a string replace method and SubString() but its ugly!

 

Thanks!

Please use plain text.
Developer
Developer
dn8
Posts: 46
Registered: ‎06-16-2009
My Device: Not Specified

Re: No Regex?

NE1?
Please use plain text.
Developer
swiebertje
Posts: 64
Registered: ‎05-09-2009
My Device: Not Specified

Re: No Regex?

Try the regexp-me project

http://code.google.com/p/regexp-me/

Please use plain text.
Developer
Developer
dn8
Posts: 46
Registered: ‎06-16-2009
My Device: Not Specified

Re: No Regex?

Thanks,

You  answered my question and pointed me in the right direction...

Please use plain text.