gran33
gran33

Reputation: 12951

Find and replace with variable

In webstorm 2017.1.1 I would like to find and replace a simple string with variable in the replace, for example:

find: testID:'

replace: testID:'${FILE_NAME}

And I expect the replace result will be testID:'MY_FILE_NAME...

Someone know if it's possible vie webstorm or via any plugin related?

Thanks in advance.

Upvotes: 0

Views: 458

Answers (1)

l0b0
l0b0

Reputation: 58788

As @SupunWijerathne said, the IDEA replace dialogue is not aware of variables. However, this is something you could easily do in a shell. For example, on Linux, and with a replacement string without any special characters, you could do this:

sed -i "s/testID:'/testID:'${FILE_NAME}/g" my-file.txt

Upvotes: 1

Related Questions