[latex]Mae govannen![/latex]
I'm usally doing this with eval:
Yuck :(
var bla = "How are u doin there?";
var search = "how";
bla.search(eval("/"+search+"/i"));
> This is not very nice ("eval is evil"), but it works.
'It works' is no excuse for really bad code.
~~~javascript
var bla = 'How are u doin there?';
var searchstr = 'how';
var reg = new RegExp(searchstr, 'i');
bla.search(reg); // 0
Cü,
Kai
--
Hard to believe that anyone would use Prototype.js at this
point. It was a bad idea in 2006 and it hasn't gotten any better with age. (David Mark)
Foren-Stylesheet Site Selfzeugs
SelfCode: sh:( fo:| ch:? rl:( br:< n4:( ie:{ mo:| va:) js:| de:> zu:) fl:( ss:| ls:?
Hard to believe that anyone would use Prototype.js at this
point. It was a bad idea in 2006 and it hasn't gotten any better with age. (David Mark)
Foren-Stylesheet Site Selfzeugs
SelfCode: sh:( fo:| ch:? rl:( br:< n4:( ie:{ mo:| va:) js:| de:> zu:) fl:( ss:| ls:?