RegEx Replacement Pattern with special characters

Usually I can figure this stuff out after some hair pulling, but I’m stumped here. This isn’t working.

rg7.SearchPattern = "\b  Command Line=/qb /norestart  /l*v "%LOGLOC%\%LOGNM%"/b"

I’ve tried many things, including the usual putting escape quotes and such around “%LOGLOC%%LOGNM%”, but nothing is working. I’m sure the \ is causing issues. Maybe the * as well.

It’s the damn asterisk. Anyone know how to escape it? Or on a replacement pattern, can I start with some of the line and tell it to grab everything until the end of the line? Then I could bypass the asterisk all together.

You can escape tokens with the backslash. \* will match a literal asterisk.

Thanks! That works, but falls apart when I add


back to the string,

Are those quotes part of what you’re trying to match?