Reputation: 153
How to find all lines of code that start and end with specified string in VScode and replace some part of those line with other string (using Regular Expression)?
For Example:
1. Find all lines that start with import
and end with .ts
(with any number or chars allowed in between)
2. Delete only .ts
part from all those lines
For example:
It should match lines like
import { AddToCompare } from '@Booking/core/modules/compare/AddToCompare.ts'
and then remove .ts
from end from all those lines to make it
import { AddToCompare } from '@Booking/core/modules/compare/AddToCompare'
PS:
To find lines starting with import
I used ^\s*import
but dont know what expression to use for rest of the pattern.
Also most solutions here are for python and grep but not for vscode.
Upvotes: 1
Views: 3171