Home > Software engineering >  Regex Select pattern if does not start with word
Regex Select pattern if does not start with word

Time:08-11

Here is an example

function[something][hello()].sub(amount, "MATCH THIS BLOCK") 

import "./something"

import "./something.txt";

import "./something.php";

import "./blha.js";

import "./blah.ts";

I need to match everything in " " but if there is starts with word import then skip

The result: "MATCH THIS BLOCK"

CodePudding user response:

You can use this regular expression:

(?<!import\s)"(.*)"
  • Related