JavaScript Variable inside a javascript regular expression variable inside javascript string,variable inside javascript,variable inside regex

I've looked at a lot of similar questions about this kind of problem but they haven't solved my problem...

This is the string that I've to match: "|6[1]|" where the "6" is a variable that I've to put inside the regexp.

I've tried to create one (pid is the variable that contain the number):

var filter = new RegExp("/\|"+pid+"[\d*\]\|/");

It's look not working.. tryed with chrome console

enter image description here

Answer:1

Is it possible to pass a named function with parameters to a jquery function as an argument instead of an anonymous function. This is what I'm trying to do: $('body').bind("click", saySomething); ...

Is it possible to pass a named function with parameters to a jquery function as an argument instead of an anonymous function. This is what I'm trying to do: $('body').bind("click", saySomething); ...

  1. pass named function javascript
  2. elixir pass named function as argument
  3. javascript pass named function as parameter
  4. pass named range vba function

I know there is the True/False option for this, but I'm wanting to have it differentiate depending on the status of a document. It only lets you select Edit or Read Only on the "Display" tab, but I'm ...

I know there is the True/False option for this, but I'm wanting to have it differentiate depending on the status of a document. It only lets you select Edit or Read Only on the "Display" tab, but I'm ...

My if statement evaluates only 1st condition, second one after || is overlooked. How to fix this? function validateAge(input) { if ((input.value < 0 || input.value > 110) || (input.value....

My if statement evaluates only 1st condition, second one after || is overlooked. How to fix this? function validateAge(input) { if ((input.value < 0 || input.value > 110) || (input.value....

I was going through a javascript book and have encountered the following code on closure function constFunc() { var funcs = []; for (var i = 0; i < 10; i++) { funcs[i] = function ()...

I was going through a javascript book and have encountered the following code on closure function constFunc() { var funcs = []; for (var i = 0; i < 10; i++) { funcs[i] = function ()...

  1. javascript function closure explained
  2. javascript function closure
  3. javascript function closure scope
  4. javascript function closure tutorial
  5. javascript function closure parameters
  6. javascript function closure for loop
  7. javascript function closure return
  8. javascript function closure meaning
  9. javascript function closure callback
  10. javascript function closure variables
  11. javascript function closure argument
  12. javascript function closure object
  13. javascript function closure values
  14. javascript closure function use
  15. javascript closure function call
  16. javascript closure function syntax
  17. javascript closure function stack overflow
  18. javascript closure function var
  19. javascript function create closure
  20. javascript anonymous function closure