Home > OS >  VScode regex get all occurences between two strings
VScode regex get all occurences between two strings

Time:09-26

I have a project that contains multiple occurrences of t('str_ing1.string2') the str_ing1 is not same for all occurrences and I want to remove str_ing1 using regex vscode search, Can anyone help?

CodePudding user response:

You can use this pattern: (?<=t\(').*?(?=\.string2)

See Regex enter image description here

CodePudding user response:

Find this regex

t('[^.'] \.

Replace

t('

If you want to keep the .

t('.

If string2 is a constant

Find

t('[^.'] \.string2

Replace

t('string2
  • Related