visual studio find / replace regular expressions

Hi

in the find/replace box for visual studio you can use regular expressions. i had a go with it but i think regular expressions in vb might eb slightly different than perl.

how do i write a regular expression for use in this dialogue that can remember the matched text.

For example, lets say i had this text:

ssss hello everyone ssss

and i wanted to replace it with

aaaa hello everyone aaaa

how would i do that? i need to remember the "hello everyone" bit

Thanks very much
andrea
andiejeAsked:
Who is Participating?
 
Fernando SotoRetiredCommented:
New example:

From this:

hello everyone aaaa

To this:

aaaa hello everyone aaaa

Then do the following in the Replace dialog box:
Find What: = {<hello everyone>} {<a^4>}
Replace With: = \2 \1 \2
0
 
Fernando SotoRetiredCommented:
Hi andieje;

Here is a link to the documentation for Visual Studio Regular Expression used in the IDE find/replace'

http://msdn2.microsoft.com/en-US/library/2k3te2cs(VS.80).aspx

In your example you want to replace the ssss in "ssss hello everyone ssss" With aaaa.

Then do the following in the Replace dialog box:
Find What: = <s^4>
Replace With: = aaaa

Fernando
0
 
andiejeAuthor Commented:
I'm sorry, i posted late last night and was being a bit thick

What i need to be able to do is this....

hello everyone aaaa

to

aaaa hello everyone aaaa

I need to really insert some text around existing text
0
 
andiejeAuthor Commented:
Marvellous - that was what i was looking for!

Thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.