.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Post New Web Links

Negative Lookbehind assertion to find all the strings from source code of particular pattern

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :.NET Framework
 
I wrote a regular expression to match all the double quoted strings in the source code but excluding those which are initializers to const declaration.

My expression was 
(?<!const\s+[Ss]tring\s+[\w_]+\s+=\s+)(\"[^\\"]*(?:\\.[^\\"]*)*\")

The first group is const declaration of string type. Second is used to match double quoted strings capable of handling escape sequences.

Problem

If i simple run a match using second group, all the strings are matched. But if i use the entire expression, it provides me all the characters between the end double quote of last string and first double quote of next string.

Please help.

Thanks
Venky









View Complete Post


More Related Resource Links

Microsoft StyleCop: Source Code Analyzer for C#

  
StyleCop is similar in many ways to Microsoft Code Analysis (specifically FxCop), but there are some important distinctions. FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.

C# and XML Source Code Documentation

  
Through many years of enterprise level software development and consulting, I became critically aware of the importance of good source code documentation, and several years ago when I began working with the first release of Visual Studio .NET beta 1 and found C# provided built-in support for inline XML code documentation, I was thrilled.

Any plans on releasing the source code for WebMatrix itself?

  

I tried reflecting into WebMatrix.exe but was unable.  I'm interested on how you integrated the WPF Ribbon & the Office-style sidebar.


How to install the Css Friendly Control Adapter Source Code

  

Hi guys really new to ASP.NET I was trying to install the CSS Friendly control adapter but for some reason the instructions on the website seems outdated. I downloaded all the files (Source Code, DLL, Browser) I believe I need to add the DLL file to my website's Bin folder and the Browser file to the APP_Browsers folder is this correct? After I place this files how to I get it working? what do I have to do?

Also if I want to create a new DLL file from the Source code how do I do these? I opened the web-site with Visual Studio 2008 and I can see all the files in the solution explorer? But how do I compile this to a DLL file? I tried doing a build solution but all I get is an .sln file???

Any help would be greatly appreciated


Thanks in advance

Carlos


Toolbox: Data Snapshots, Subversion, Source Code Organization and More

  

If you want to save, organize, and annotate snapshots of your database data, find an easy way to install and configure Subversion, and automate the organization of your source code, then you'll want to read more about these latest tools.

Scott Mitchell

MSDN Magazine August 2009


Code Reviews: Find and Fix Vulnerabilities Before Your Application Ships

  

Code defects can be found using many approaches, but manual code reviews stand out in terms of precision and quality. We provide some best practices for planning and executing code reviews on your own team.

M. Chmielewski, N. Clift, S. Fonrobert, and T. Ostwald

MSDN Magazine November 2007


Toolbox: Find Bottlenecks, Code Similarities, and More

  

This month, find performance and memory bottlenecks, essential security reading, and more.

Scott Mitchell

MSDN Magazine July 2007


Are You in the Know?: Find Out What's New with Code Access Security in the .NET Framework 2.0

  

Unlike role-based security measures, code access security is not based on user identity. Instead, it is based on the identity of the code that is running, including information such as where the code came from. Here Mike Downen discusses the role of code access security (CAS) in .NET and outlines some key new features and changes in CAS for the .NET Framework 2.0.

Mike Downen

MSDN Magazine November 2005


Protect It: Safeguard Database Connection Strings and Other Sensitive Settings in Your Code

  

Protecting application secrets, such as database connection strings and passwords, requires careful consideration of a number of pertinent factors such as how sensitive the data is, who could gain access to it, how to balance security, performance, and maintainability, and so forth. This article explains the fundamentals of data protection and compares a variety of techniques that can be used to protect application settings. The author discusses what to avoid, such as hiding keys in source code and the use of Local Security Authority. In addition, he presents some effective solutions such as the Data Protection API.

Alek Davis

MSDN Magazine November 2003


Rotor: Shared Source CLI Provides Source Code for a FreeBSD Implementation of .NET

  

With over 9,000 files, and including some 1300 public classes to pore through, the Shared Source CLI can teach you quite a bit about the internal workings of the CLR. But the sheer amount of source code included can make just starting your exploration a monumental task. This article discusses some of the things you can learn from the source code facsimile of the CLR, like how JIT compilation works. It will also help you understand how to control execution along with debugging and loading classes. A walk through the steps involved in setting up the runtime will let you become familiar with the process.

Jason Whittington

MSDN Magazine July 2002


Virtual Source Code Control Systems: Promoting and Managing Projects using Visual SourceSafe

  

Source code control systems like Microsoft Visual SourceSafe can simplify just about any development project, and make it easier for your code to move safely among individual programmers, development teams, and project stages. Visual SourceSafe provides an object model that you can use as the basis of your own customized source code control environment. To give you an idea of what is possible, we'll walk you through the elements of a browser-based source code control system built with Visual SourceSafe, ASP, and VBScript. This simple system lets members of your team build, label, and promote individual files or entire projects, and to reverse promotions.

Ken Ramirez

MSDN Magazine May 2000


The Weekly Source Code 56 - Visual Studio 2010 and .NET Framework 4 Training Kit - Code Contracts, P

  
Do you like a big pile of source code? Well, there is an imperial buttload of source in the Visual Studio 2010 and .NET Framework 4 Training Kit . It's actually a 178 meg download, which is insane. Perhaps start your download now and get it in the morning when you get up. It's extremely well put together and I say Kudos to the folks that did it. They are better people than I. I like to explore it while watching TV myself and found myself looking through tonight. I checked my blog and while I thought I'd shared this with you before, Dear Reader, I hadn't. My bad, because it's pure gold . With C# and VB, natch. Here's an outline of what's inside. I've heard of folks setting up lunch-time study groups and going through...(read more)

Where can I find the code of the Twitter or Facebook or WebGrid helpers?

  

Just in general, where can I find the code to take a look at and learn from them? Or at least look at the functions available to me as I do get the feeling that the insufficient documentation at the moment reveals all.


Inventory Source Code

  

I'm looking for some C# or VB.Net/Asp.Net source code for a simple inventory system. I've googled and what I've found is only vb6 code.

Can you help?

Thanks,

Dave 


Find and replace link source

  
I want to replace links href in the source code using regular expression in Find/Replace dialog box from http://www.abc.com/car-news/13PX5S/News1.aspx, http://www.abc.com/car-news/27JXW5/News2.aspx to http://www.abc.com/car-news/news1/13px5s/, http://www.abc.com/car-news/news2/27jxw5/   - in the resultant URL there will be no Capital letters.    

Extract text from html source code

  
i wan to extract Desired Title,Desired Text and Desired link from Webpage source code and paste in richTextBox1. <a href="/site/show/link/0/type/0">Desired Titl e</a> <a title="&lt;b&gt;Text preview&lt;/b&gt; &lt;br/&gt;Some Text" class="pdtip" href="/site/show/link/0/type/0">Text</a><br />Desired text <br /> <label class="url" for="">http://Desiredlink.com </label> Output: Desired Title Desired Title Desired link How can i do this?
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend