• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Regular expression to replace a string that is not in a quoted substring.

Is it possible to replace all letters "a" that are outside all quoted strings with "&".
E.g. Debug.Print(
Regex.replace("And Don't Forget&Experts love to get the ""answer""""s accepted"" as the solution to your question.", <some pattern>
)
should print
&nd Don't Forget&Experts love to get the "answer""s accepted" &s the solution to your question.

I don't know what the pattern might be to SKIP some matches (quoted strings) while searching for others (just "a").
0
midfde
Asked:
midfde
1 Solution
 
ozoCommented:

"[aA](?=[^""]*((""[^""]*){2})*$)"
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now