Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
This is related to a question asked yesterday about the use of RegEx to give it full title:
RegEx madness, or how to make it variable?
by using ProEggNog's answers I have managed to get the application to use

C#
//     string regExp = @"(?<=<).+?(?=>)";     //working RegEx for < > around data
     //     string regExp = @"(?<=\[).+?(?=\])";//working RegEx for [ ] around data
     //     string regExp = @"(?<=!).+?(?=!)";//working RegEx for ! ! around data
          string regExp = @"(?<=\").+?(?=\")";//?????????

however I'm trying use " around the data my first though was to place \ in front of the " as the intelli-sense showed it was seeing the " as the closing " for the statement, the Expresso app for the 30 Minute RegEx tutorial seems to agree with me though? anyone any ideas apart from don't use " ???
Glenn
Posted
Updated 26-Mar-12 22:42pm
v2
Comments
Manfred Rudolf Bihy 27-Mar-12 4:45am    
"ProEggNog", eh? I think ProEngSoft would be a better fit, but hey do as you please.
OriginalGriff 27-Mar-12 4:48am    
Maybe he is the one person in the world who actually enjoys egg nog? :laugh:
glennPattonWork3 27-Mar-12 5:02am    
To all who have seen this I am sorry ProEngSoft, thinking about not relavent!

1 solution

Right, yes...
Try:
C#
string regExp = @"(?<=\"").+?(?=\"")";
When you prefix a string with '@' it turns normal blackslash processing
off, so \" doesn't work any more. You need to use "" instead to insert a single double quote, and backslash on it's own to insert a backslash.
 
Share this answer
 
Comments
glennPattonWork3 27-Mar-12 5:51am    
Dang! thought I tried it and it didn't work, tried it again (with the " in the right places probably)
OriginalGriff 27-Mar-12 6:01am    
:laugh: I have days like that all the time!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900