473,799 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What classes handle regular expressions?

I'll be working with regular expressions and
hopeful as i am, i count on that there are
tools ready to handle e.g. file operations
using regular expressions.

Please tell me it's so and give me a pointer
to what classes/packages to aim at.

--
Regards
Konrad Viltersten
Jul 22 '08 #1
6 1200
This depends on the work you will be doing. The regular expression classes in
..NET are in the System.Text.Reg ularExpressions namespace. Most prominantly
its hte RegEx class.
These will allow you to match Regular expressions to text. You would need to
code the file operations around this functionality.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"K Viltersten" wrote:
I'll be working with regular expressions and
hopeful as i am, i count on that there are
tools ready to handle e.g. file operations
using regular expressions.

Please tell me it's so and give me a pointer
to what classes/packages to aim at.

--
Regards
Konrad Viltersten
Jul 22 '08 #3
This depends on the work you will be doing. The regular expression classes
in
.NET are in the System.Text.Reg ularExpressions namespace. Most prominantly
its hte RegEx class.
These will allow you to match Regular expressions to text. You would need
to
code the file operations around this functionality.
Oh, right, i ment to do the file operations myself, of course. As
long as i get the strings right, i can do the rest easily. Thanks.

I've been browsing and i'm getting an impression that what
some people refer to as regular expressions, isn't fully
well-defined. It seems that Microsoft uses a different pattern
to denote the regularities in the expressions that some
other system suggest. Is it true?

--
Regards
Konrad Viltersten
Jul 22 '08 #4
K Viltersten wrote:
I've been browsing and i'm getting an impression that what
some people refer to as regular expressions, isn't fully
well-defined. It seems that Microsoft uses a different pattern
to denote the regularities in the expressions that some
other system suggest. Is it true?
Reasonable well defined. There are some differences among
implementations . But they are mostly in the advanced stuff - the
basic stuff is the same everywhere.

Arne
Jul 22 '08 #5
K Viltersten wrote:
I'll be working with regular expressions and
hopeful as i am, i count on that there are
tools ready to handle e.g. file operations
using regular expressions.

Please tell me it's so and give me a pointer
to what classes/packages to aim at.
For inspiration see below.

Arne

=============== =============== ========

using System;
using System.IO;
using System.Text.Reg ularExpressions ;

namespace E
{
public static class MyExtensions
{
public static FileInfo[] GetFilesRegExp( this DirectoryInfo di,
string pat)
{
Regex re = new Regex(pat);
return Array.FindAll(d i.GetFiles(), (f) =>
re.IsMatch(f.Na me));
}
}
public class Program
{

public static void Main(string[] args)
{
Regex re = new Regex(@"^[Zz].*$");
DirectoryInfo di = new DirectoryInfo(@ "C:\");
FileInfo[] f1 = Array.FindAll(d i.GetFiles(), (f) =>
re.IsMatch(f.Na me));
foreach(FileInf o f in f1)
{
Console.WriteLi ne(f.FullName);
}
FileInfo[] f2 = di.GetFilesRegE xp(@"^[Zz].*$");
foreach(FileInf o f in f2)
{
Console.WriteLi ne(f.FullName);
}
Console.ReadKey ();
}
}
}
Jul 23 '08 #6
>I'll be working with regular expressions and
>hopeful as i am, i count on that there are
tools ready to handle e.g. file operations
using regular expressions.

Please tell me it's so and give me a pointer
to what classes/packages to aim at.

For inspiration see below.
<snip>

For all it's worth, i'm inspired! ;)
Thanks!

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Jul 23 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3922
by: Martin Robins | last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being parsed can completely wreck it. The string I am trying to parse is as follows: commandText=insert into (Text) values (@message + N': ' + @category);commandType=StoredProcedure; message=@message; category=@category I am looking to retrive name value...
9
380
by: MJ | last post by:
HI I want to know what is mean by regular expression in C Mayur
4
1957
by: GenoJoe | last post by:
If you are not new to VB.NET but are new to regular expressions, you need to get a free copy of "Pragmatic Guide to Regular Expressions for VB.NET Programmers". I wrote this guide because all of the sources that I researched for information on this topic, including Microsoft Help pages, did not properly address it from the viewpoint of someone new to regular expressions. If you send me an email, I will return you a zipped file that includes...
2
5100
by: Sehboo | last post by:
Hi, I have several regular expressions that I need to run against documents. Is it possible to combine several expressions in one expression in Regex object. So that it is faster, or will I have to use all the expressions seperately? Here are my regular expressions that check for valid email address and link Dim Expression As String =
2
2475
by: cleo | last post by:
I'm experimenting with Regular Expressions and Windows Forms. Frequently I want a value to be either a valid pattern or empty. For example a Zip code must be 5 digits or may be empty. I know that I can use the Regular Expression "\d{5}" to test for exactly 5 digits. How can I add the option for the string to be empty or must I always test the value before calling the Regular Expression? Thanks
4
5187
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or adate LIKE "2004.01.10 __:15") .... into something like this: .... where adate LIKE "2004.01.10 __:(30/15)" ...
7
3831
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I want to avoid that. My question here is if there is a way to pass either a memory stream or array of "find", "replace" expressions or any other way to avoid multiple copies of a string. Any help will be highly appreciated
20
416
by: Asper Faner | last post by:
I seem to always have hard time understaing how this regular expression works, especially how on earth do people bring it up as part of computer programming language. Natural language processing seems not enough to explain by the way. Why no eliminate it ?
3
2300
by: ommail | last post by:
Hi I wonder if regular expressions are in general sower than using classes like String and Char when used for validating/parsing text data? I've done some simple test (using IsMatch()) method and the result was that Regex is either as fast or two times slower than method which used methods from classes
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.