So I have a string of the English alphabet for example. But I don't know the alphabet very well but I do know that it starts with "abc" and that it ends in "xyz". I want to remove letters "b" to "x". I want to do something like str = str.replace("bc*x",""); or str = str.replace("bc"*"x",""); but I don't know how I can make it work or even if whether Asterisk will work like this in JavaScript.

how can I remove something like everything except for "efg" from "abcdefghijklm" without know what anything is except for "ef"?

how can I remove something like everything except for "efg" from "abcdefghijklm" without know what anything is except for "ef"?

var alpha = 'abcdefghijklm';
var pattern = 'ef';
var re = new RegExp(pattern+".");
result = alpha.replace(re,"");
alert(result);

using for loop?

http://jsfiddle.net/cLLfq/

I don't understand this.

var alpha = 'abcdefghijklm';
var pattern = 'ef';
var re = new RegExp(pattern+".");
result = alpha.replace(re,"");
alert(result);

Is there a way to make result=efg? Or even just remove everything infront of efg.

Is there a way to make result=efg?

   var result  = alpha.match("efg");

Or even just remove everything infront of efg.

   var result = alpha.substring(alpha.match("efg").index);

Many Thanks To All Of You! :)