I’m trying to insert a comment character into a string something similar to this:
-CreateVideoTracker VT1 'vt name'
becomes
-CreateVideoTracker VT1 # 'vt name'
The VT1 word can actually be anything, so I’m using the regex
$line =~ s/\-CreateVideoTracker \w/\-CreateVideoTracker \w # /g;
which gives me the result:
-CreateVideoTracker w #T1 'vt name'
Is there any way to do this with a single regex, or do I need to split up the string and insert the comment manually?
The bracketed expressions (known as ‘capture buffers’) in the first half of the regexp are referenced as
$1,$2. etc in the second half.