Find replace number followed by character in quotes inside parenthesis visual studio 2019

Viewed 26

I'm trying to change all string arguments to function DEBUG(mode) to enum and all strings starting with an integer will have m added to the front:

Examples:

Original Result
DEBUG("LOG_EVENTS") DEBUG(LOG_EVENTS)
DEBUG("3b") DEBUG(m3b)

I have:

Find: DEBUG\\("([a-zA-Z]+\.h)"\\)
Replace: DEBUG\\($1\\)

and

Find: DEBUG\\("([0-9]+h)"\\)
Replace: DEBUG\\(m$1\\)

but I find 0 occurrences for both queries.

1 Answers

Use this for the leading alpha search:

Find: DEBUG\("([a-zA-Z]\w*)"\)
Replace: DEBUG($1)

See live demo.

and this for the leading numeric search:

Find: DEBUG\("(\d\w+)"\)
Replace: DEBUG(m$1)

See live demo.


I think your basic problem is the "h" in your find terms.

Related