Question: I have a series of strings like this:

```
http://mytestdomain.com/bla/abc/?zde&wpv_paged=2
http://mytestdomain.com/bla/abc/?zde&wpv_paged=3
http://mytestdomain.com/bla/abc/?zde&wpv_paged=4
http://mytestdomain.com/bla/abc/?zde&wpv_paged=5

```

etc

I need a way to remove the `'&wpv_paged='` part of the string as well as everything after it

My question is, should I use `regex` or `split()` for this and if so, how would I achieve this?

Thanks

Answer: 
```
&wpv_paged=\d+.*$

```

You can try this.Replace with `empty string`.See demo.

<http://regex101.com/r/sU3fA2/7>
```
var url = "http://mytestdomain.com/bla/abc/?zde&wpv_paged=2".split("&wpv_");

```

`url[0]` will give you the segment of the url before the "&wpv\_"-part