Question: I have an expression.

```
var expression = "Q101='You will have an answer here like a string for instance.'"

```

I have a regular expression that searches the expression.

```
var regEx = new regExp(/=|<>|like/)

```

I want to split the expression using the regular expression.

```
var result = expression.split(regExp)

```

This will return the following:

```
["Q101", "'You will have an answer here ", " a string for instance'"]

```

This is not what I want.

I should have:

```
["Q101", "'You will have an answer here like a string for instance'"]

```

How do I use the regular expression above to split only on the **first** match?

Answer: 
Since you only want to grab the two parts either side of the first delimiter it might be easier to use [`String.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match) and discard the whole match:

```js
var expression = "Q101='You will have an answer here like a string for instance.'";

var parts = expression.match(/^(.*?)(?:=|<>|like)(.*)$/);
parts.shift();
console.log(parts);

expression = "Q101like'This answer uses like twice'";
parts = expression.match(/^(.*?)(?:=|<>|like)(.*)$/);
parts.shift();
console.log(parts);
```
While JavaScript's `split` method [does](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/split) have an optional `limit` parameter, it simply discards the parts of the result that make it too long (unlike, e.g. Python's `split`). To do this in JS, you'll need to split it manually, considering the length of the match —

```js
const exp = "Q101='You will have an answer here like a string for instance.'"

const splitRxp = /=|<>|like/
const splitPos = exp.search(splitRxp)
const splitStr = exp.match(splitRxp)[0]

const result = splitPos != -1 ? (
  [
    exp.substring(0, splitPos),
    exp.substring(splitPos + splitStr.length),
  ]
) : (
  null
);

console.log(result)
```