3

I am using NetBeans 8.2. I am working in the code editor window and trying to use regex in combination with the NetBeans find/replace feature. I have the regex button turned on.

I am trying this enter image description here

on this code

    specStripWidthUpper: $("#uniflytebundle_quoteitem_QuoteRing_specStripWidthUpper"),
    specStripWidthLower: $("#uniflytebundle_quoteitem_QuoteRing_specStripWidthLower"),

The result I would like would take 1st Category found in find regex

specStripWidthUpper

and repeat it on other side of colon ":" like

specStripWidthUpper:specStripWidthUpper

instead it replaces the selection with $1. looking like

    specStripWidthUpper:$1,
    specStripWidthLower:$1,

Is there a NetBeans setting to run regex for the replace input window or am I doing something incorrect?

Thank you in advance for your time and effort.

drwoodchip
  • 115
  • 2
  • 11

1 Answers1

4

Netbeans (8.2?) does not like the lookarounds. I do not know if this is a new thing but you can get around it with a simplified pattern.

However, your pattern does not capture the part you want to repeat, i.e. specStripWidthUpper (you can see this when you toggle the Select option).

Try it like this:

(\w+)(?:\:)(.*),
$1:$1

You might be required to anchor the query to avoid false positives.

wp78de
  • 18,207
  • 7
  • 43
  • 71