Click here to Skip to main content
15,891,976 members
Home / Discussions / C#
   

C#

 
GeneralLocked files Pin
Johan Martensson16-Jan-08 8:50
Johan Martensson16-Jan-08 8:50 
GeneralRe: Locked files Pin
Giorgi Dalakishvili16-Jan-08 9:25
mentorGiorgi Dalakishvili16-Jan-08 9:25 
GeneralHighlight Pin
simworld16-Jan-08 8:47
simworld16-Jan-08 8:47 
GeneralRe: Highlight Pin
DaveyM6916-Jan-08 8:51
professionalDaveyM6916-Jan-08 8:51 
QuestionIPC - best solution? Pin
DaveyM6916-Jan-08 8:10
professionalDaveyM6916-Jan-08 8:10 
QuestionHow to organize dozens of excel reports into 1 solution? Pin
Goalie3516-Jan-08 5:27
Goalie3516-Jan-08 5:27 
AnswerRe: How to organize dozens of excel reports into 1 solution? Pin
martin_hughes16-Jan-08 8:15
martin_hughes16-Jan-08 8:15 
GeneralProbably an easy Regex question Pin
Andrew Stampor16-Jan-08 5:14
Andrew Stampor16-Jan-08 5:14 
This is probably something easy for someone who is experienced with Regex and regular expressions in general. Unfortunately, I am not one of those people. Perhaps one of you kind souls will take pity on me and help me out here.

I need to replace a part of a string with another string. I only want to replace the first instance. An example of the the beginning of the string being searched is as follows:

<chart first_node_id="None" item_id="323f359f-f2db-4cd5-b779-aebc1349d587" form_type="None" name="here is an old name" last_modified="1/16/2008 11:03:33 AM"><br />
  <node name="don't change this name" node_id="ff918de6-213d-4a11-8c1c-ce5b54c7d8f2" result="None" 


What I want to find and replace is the "here is an old name" part. Note that 'name=' is repeated, and I only want the first one replaced.

I've tried several different expressions, but the one I am currently toying with is as follows:
<br />
Regex regExp = new Regex("name=\"(.*)\"");<br />
string test = regExp.Replace(oldString,newName,1);<br />


This doesn't do what I want. It finds 'name="here is an old name" last_modified="1/16/2008 11:03:33 AM"' and replaces the whole thing instead of just what is between the quotation marks.

I've been trying to read up on reg expressions and Regex, but the time crunch I am under is making me impatient and it is hard to learn with that mentality. So, any help you can provide would be most appreciated. Thanks in advance.
GeneralRe: Probably an easy Regex question Pin
TJoe16-Jan-08 7:44
TJoe16-Jan-08 7:44 
GeneralRe: Probably an easy Regex question Pin
Andrew Stampor16-Jan-08 7:54
Andrew Stampor16-Jan-08 7:54 
GeneralRe: Probably an easy Regex question Pin
martin_hughes16-Jan-08 10:57
martin_hughes16-Jan-08 10:57 
GeneralSQL Server pool size Pin
DannyAdler16-Jan-08 3:41
DannyAdler16-Jan-08 3:41 
GeneralRe: SQL Server pool size Pin
Justin Perez16-Jan-08 3:53
Justin Perez16-Jan-08 3:53 
GeneralRe: SQL Server pool size Pin
DannyAdler16-Jan-08 4:15
DannyAdler16-Jan-08 4:15 
GeneralRe: SQL Server pool size Pin
Justin Perez16-Jan-08 4:34
Justin Perez16-Jan-08 4:34 
GeneralRe: SQL Server pool size Pin
DannyAdler16-Jan-08 21:02
DannyAdler16-Jan-08 21:02 
GeneralRe: SQL Server pool size Pin
DannyAdler16-Jan-08 4:24
DannyAdler16-Jan-08 4:24 
GeneralTiff to AVI Pin
Ylno16-Jan-08 3:06
Ylno16-Jan-08 3:06 
GeneralCheck if a Bitmap has tranparency Pin
DannyAdler16-Jan-08 2:43
DannyAdler16-Jan-08 2:43 
GeneralRe: Check if a Bitmap has tranparency Pin
Christian Graus16-Jan-08 9:20
protectorChristian Graus16-Jan-08 9:20 
GeneralRe: Check if a Bitmap has tranparency Pin
DannyAdler16-Jan-08 23:06
DannyAdler16-Jan-08 23:06 
GeneralDisplay comboBox in usercontrol property Pin
Peterson Luiz16-Jan-08 2:23
Peterson Luiz16-Jan-08 2:23 
GeneralRe: Display comboBox in usercontrol property Pin
Justin Perez16-Jan-08 3:16
Justin Perez16-Jan-08 3:16 
GeneralRe: Display comboBox in usercontrol property Pin
Peterson Luiz16-Jan-08 4:34
Peterson Luiz16-Jan-08 4:34 
GeneralRe: Display comboBox in usercontrol property Pin
Gareth H16-Jan-08 12:07
Gareth H16-Jan-08 12:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.