Question: Trying to split the `http://` from `http://url.com/xxyjz.jpg` with the following:

```
var imgUrl = val['url'].split(/(^http:\/\/)/);

```

And, even though I can get my desired result with the code above, I get some extra parameters that I would like not to have.

Output: 

> 
> ["", "http://", "url.com/xxyjz.jpg"]
> 
> 
> 

So, the question is: What am I doing wrong that I get the extra `""`, besides the `"http://"`?

Answer: 
You could use `match` instead of `split`:

```
var matches = str.match(/(http:\/\/)(.*)/).slice(1);

```

That will give you the array you want.
you can just reference the index:

```
var a=str.match(/http:\/\/(.*)/)[1]

```