Markus
Markus

Reputation: 111

Replace string but keep number (Visual Studio Code)

I need to change some variable declarations that look like:

VARCHAR2(...)

With ... beeing some number (one, two or three digits). End result should look like:

VARCHAR2(... char)

Important is, that the number has to bee kept. Example:

VARCHAR2(20) --> VARCHAR2(20 char)

sed or awk are also options but Visual Studio Code would be preferred.

Thanks in advance

Markus

Upvotes: 1

Views: 1284

Answers (2)

jps
jps

Reputation: 22545

Click on Edit->Replace or CTRL+H

and use the following regular expression for find:

(VARCHAR2[(]\d+)([)])

and

$1 char$2

for replace. Of course, the use of regular expressions (the .* symbol in the find line) has to be turned on (ALT+R).

enter image description here

Upvotes: 1

Mark
Mark

Reputation: 182331

(VARCHAR2\(\d{1,3})\) replace with

$1 char)

Upvotes: 1

Related Questions