?
Solved

visual studio find / replace regular expressions

Posted on 2006-03-27
4
Medium Priority
?
366 Views
Last Modified: 2011-09-20
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
0
Comment
Question by:andieje
  • 2
  • 2
4 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16306289
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
 

Author Comment

by:andieje
ID: 16309357
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
 
LVL 64

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 16311866
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
 

Author Comment

by:andieje
ID: 16327376
Marvellous - that was what i was looking for!

Thanks a lot
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question