VSCode wildcard Search and Replace Regex

You’ll need to use .+? instead of * here since this uses regular expressions.

In regular expressions a dot . means “any character”, the plus + means “one or more times”, and the question mark ? after this means “try to match this as few as possible times” – which is useful so it won’t keep matching past your quote marks

edit

To be clear though, you have to make a valid regex, which means you’ll need to escape your parenthesis, dots, etc.

Here’s the full solution

Find: drivers\[i\]\.findElement\(By\.id\("(.+?)"\)\)\.click\(\);

replace with: findAndClick(driver[i], "$1", true)

Note the added unescaped parentheses in there around the “wildcard” (.+) this creates a capture group in a regex, which is what translates to $1 in the replacement since it’s the 1st capture group.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)