-
May 25th, 2010, 04:15 AM
#1
[RESOLVED] Regex search & replace
I'm struggling a bit trying to figure out what regular expression to use for search & replace
For example, I want to replace all occurrences of text that begins with [MSG_74_ and ends with ] and add a quote " after the [ and before the ]
i.e.
msg[MSG_74_HELLO]
to
msg["MSG_74_HELLO"]
A break down of what each bit of the regex expression does would help too.
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
May 25th, 2010, 06:21 AM
#2
Re: Regex search & replace
You want to do this programmaticaly or you want it in Visual Studio replace window? You didn't specify.
-
May 25th, 2010, 06:24 AM
#3
Re: Regex search & replace
Visual Studio replace window
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
May 25th, 2010, 07:26 AM
#4
Re: Regex search & replace
Search for
\[MSG_74{[^\]]*}\]
Replace with
\["MSG_74\1"\]
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
-
May 25th, 2010, 07:48 AM
#5
Re: Regex search & replace
Cheers, that works great.
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|