| | |
exclude comments using Regular Expressions
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2006
Posts: 4
Reputation:
Solved Threads: 0
i gotta use regex.match(regularexpression) . I am using a streamreader to read the whole file and then the contents of the file are match with the pattern of the regular expression . and this regular expression needs to count all the lines of code excluding watever is written in comments .
eg
//test1
//test2
/* test3 */
using System;
using System.Collections.Generic; /* test4 */
using System.Text;
using System.Collections;
using System.IO;
using System.Text.RegularExpressions;
namespace Regular_Test
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Good");
}
}
}
this shud remove all the comments .. ie shud count all the line of code except comments (/*..*/) , (//) wherever they appear .
eg
//test1
//test2
/* test3 */
using System;
using System.Collections.Generic; /* test4 */
using System.Text;
using System.Collections;
using System.IO;
using System.Text.RegularExpressions;
namespace Regular_Test
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Good");
}
}
}
this shud remove all the comments .. ie shud count all the line of code except comments (/*..*/) , (//) wherever they appear .
![]() |
Similar Threads
- Regular Expressions (VB.NET)
- Parsing a log file using regular expressions (C#)
- Regular Expressions (Computer Science)
- Regular Expressions (C#)
- mod_rewrite: help with regular expressions (Linux Servers and Apache)
- matching regular expressions (Java)
Other Threads in the C# Forum
- Previous Thread: System.NullReference Exception
- Next Thread: Dropdownlist.... please help
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client color combo combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees developer development draganddrop drawing encryption enum equation event excel file files form format forms function gdi+ httpwebrequest image index input install java label list listbox listener mandelbrot math mathematics mouseclick mysql nargalax operator path photoshop picturebox pixelinversion post programming radians regex remote remoting restore richtextbox save saving serialization server sleep socket sql stack statistics stream string table tcp text textbox thread time timer update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






