JavaScript Javascript Regex: how to simulate “match without capture” behavior of positive lookbehind? javascript regex simulator,js regex simulator

I have a relatively simple regex problem - I need to match specific words in a string, if they are entire words or a prefix. With word boundaries, it would look something like this:

\b(word1|word2|prefix1|prefix2)

However, I can't use the word boundary condition because some words may start with odd characters, e.g. .999

My solution was to look for whitespace or starting token for these odd cases.

(\b|^|\s)(word1|word2|prefix1|prefix2)

Now words like .999 will still get matched correctly, BUT it also captures the whitespace preceding the matched words/prefixes. For my purposes, I can't have it capture the whitespace.

Positive lookbehinds seem to solve this, but javascript doesn't support them. Is there some other way I can get the same behavior to solve this problem?

Answer:1

Let me cut to the chase. It's on this site: http://www.smb.nu/wip/kampanj/ The white bar with the links is supposed to stick to the top when scrolled past, this effect is achieved with some simple ...

Let me cut to the chase. It's on this site: http://www.smb.nu/wip/kampanj/ The white bar with the links is supposed to stick to the top when scrolled past, this effect is achieved with some simple ...

Quick question. Why does the following give a this.testFunction is not a function error? Test = { data: true, testFunction: function() { this.data = true; }, initialize: ...

Quick question. Why does the following give a this.testFunction is not a function error? Test = { data: true, testFunction: function() { this.data = true; }, initialize: ...

  1. simple javascript object
  2. simple javascript object example
  3. create simple object javascript

I have one text box. When I enter a date with the format MM/DD/YYYY in that textbox and click outside the textbox I need to display the result as MM/DD/YYYY+3 using JavaScript. For example, if my ...

I have one text box. When I enter a date with the format MM/DD/YYYY in that textbox and click outside the textbox I need to display the result as MM/DD/YYYY+3 using JavaScript. For example, if my ...

  1. 3 days given up smoking
  2. three days is given
  3. given three days notice
  4. three days grace given to me
  5. three days grace given to me скачать

I am using the MEAN stack and trying to display an image stored in my Mongo database. I believe that the image is correctly stored and being correctly passed to the browser as when I use Web Console ...

I am using the MEAN stack and trying to display an image stored in my Mongo database. I believe that the image is correctly stored and being correctly passed to the browser as when I use Web Console ...

  1. canvas
  2. canada
  3. cancelled
  4. canceled vs cancelled
  5. canada vaccines
  6. canada goose
  7. cane corso
  8. canes
  9. canadian prime minister
  10. cancun flights
  11. canker sore
  12. candy
  13. cancer
  14. cancun
  15. canon
  16. canvas prints
  17. cancer sign
  18. candace owens
  19. canada news
  20. candytopia