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

Web and WebWorks Development

Reply
Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2
Accepted Solution

Search string in variable

Hi,

 

I am trying to find a string in a variable. It is working for case-insensitive matching when the string starts with the word that I am looking for. Unfortunatly its not working through the complete string.

 

var title = "Hello World";
var value = "world";
var expr = new RegExp(value,'gi');
if (!title.search(expr)) {
 alert(title);
}

 Is this a webkit bug or is it just the wrong way and it exist a better one?

 

bert2002



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de
Highlighted
Developer
Posts: 172
Registered: ‎05-01-2010
My Device: Z10
My Carrier: O2

Re: Search string in variable

Replacing "search" with "match" and you are goot to go Smiley Very Happy



----------------------------------------------------------
find my widgets -> http://blackberry.itbert.de