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
New Developer
Posts: 6
Registered: ‎07-01-2009
My Device: Not Specified

PatternRepository overrides built-in URL handling

I'm developing an app where we want to be able to pass URLs in emails and text messages to my application. To achieve this, I register my ApplicationMenuItem with the PatternRepository using the following regular expression:

"(([A-Za-z]{3,9})://)?([-;:&=\\+\\$,\\w]+@{1})?(([-A-Za-z0-9]+\\.)+[A-Za-z]{2,3})(:\\d+)?((/[-\\+~%/\\.\\w]+)?/?([&?][-\\+=&;%@\\.\\w]+)?(#[\\w]+)?)?";

Now, while this regular expression certainly recognizes URLs in plain text messages so that my menu item is added, it has the unfortunate side effect that the ususal "Get Link" menu option is missing from the menu. Is there a way to avoid this? Currently I have to explicitly add a second menu item that allows users to open URLs with the BlackBerry Browser.


A second, currently not-as-important issue is that my regexp doesn't work with links in HTML messages. Is there a way to recognize these links? As I understand it, the pattern matching is performed on the text that's actually visible to the user, which of course won't work with link descriptions wrapped in anchor tags.

Developer
Posts: 17
Registered: ‎11-02-2009
My Device: Not Specified

Re: PatternRepository overrides built-in URL handling

I have the same problem with my app when registering a pattern to recognize a URL and the "Get Link" is missing.  Did you find a solution to this?

Highlighted
New Developer
Posts: 6
Registered: ‎07-01-2009
My Device: Not Specified

Re: PatternRepository overrides built-in URL handling

No, I didn't. I had to make a workaround where I add a second command and basically implement "Get Link" myself by opening the browser. I'd really appreciate some feedback from RIM on this, as surely we can't be the only two developers that want to handle URLs.