Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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
 
//     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 26-Mar-12 23:40pm
Edited 26-Mar-12 23:42pm
v2
Comments
Manfred R. Bihy at 27-Mar-12 4:45am
   
"ProEggNog", eh? I think ProEngSoft would be a better fit, but hey do as you please.
OriginalGriff at 27-Mar-12 4:48am
   
Maybe he is the one person in the world who actually enjoys egg nog? :laugh:
glennPattonWork at 27-Mar-12 5:02am
   
To all who have seen this I am sorry ProEngSoft, thinking about not relavent!

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Right, yes...
Try:
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.
  Permalink  
Comments
glennPattonWork at 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 at 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)

  Print Answers RSS
0 Mathew Soji 334
1 Maciej Los 295
2 BillWoodruff 290
3 Afzaal Ahmad Zeeshan 257
4 DamithSL 225
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,045


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 27 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100