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

Native Development

Reply
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus
Accepted Solution

QML Javascript escape character

I'm trying to use a regular expresssion in a javascript function, in a QML file, as follows:

 

function parseAndHandleHyperlinks(inString)
{
    result = inString.replace(\[.*\]\(.*\)/g, "");
    return result;
}

 Each backslash is underlined and has the following error: "mismatched input '\' expecting LF"

 

Those backslashes are being used to escape their following characters, so I can match the literals [,],(,)

 

p.s. the function doesn't do anything, I'm just trying to make QML accept my regular expression at the moment.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: QML Javascript escape character

That doesn't look like a valid regular expression in JavaScript. Aren't you missing a leading / (forward slash) to go with the final one just before the "g"?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: QML Javascript escape character

It would appear so! Thanks.
----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!