i need to replace all HTML path in a projet. for example:
import template from './achievementBadge.html'
into
const template = require(`html-loader!./achievementBadge.html`).default;
is there a way to do it in IntelliJ?
CodePudding user response:
The matching pattern:
^import\s*template\s*from\s*'(.*)\.html'$
- Ensuring to match the start of the lines with
^import\s*template\s*from\s*
and considering the possibility of many spaces between each word. - Ensuring to match the end of the line with
.html'$
. (.*)
will match the file path excluding its extension and capture it in a group.
The replacement string:
const template = require(`html-loader!$1\.html`).default;
$1
will bring the file path excluding its extension to the replacement string.