Question: I'm trying to detect an occurrence of a string within string. But the code below always returns "null". Obviously something went wrong, but since I'm a newbie, I can't spot it. I'm expecting that the code returns "true" instead of "null"

```
var searchStr = 'width'; 
var strRegExPattern = '/'+searchStr+'\b/'; 
"32:width: 900px;".match(new RegExp(strRegExPattern,'g'));

```

Answer: 
Please don't put '/' when you pass string in RegExp option

Following would be fine

```
var strRegExPattern = '\\b'+searchStr+'\\b'; 
"32:width: 900px;".match(new RegExp(strRegExPattern,'g'));

```
You can use **back tick** symbol to make your string dynamic **"`"**.

```
var colName = 'Col1';
var result = strTest.match(`xxxxxxx${colName}`);

```

by injecting `${colName}` in to the text, it can be editable dynamically.