472,951 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,951 software developers and data experts.

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 1167
This depends on the work you will be doing. The regular expression classes in
..NET are in the System.Text.RegularExpressions 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.RegularExpressions 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.RegularExpressions;

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

public static void Main(string[] args)
{
Regex re = new Regex(@"^[Zz].*$");
DirectoryInfo di = new DirectoryInfo(@"C:\");
FileInfo[] f1 = Array.FindAll(di.GetFiles(), (f) =>
re.IsMatch(f.Name));
foreach(FileInfo f in f1)
{
Console.WriteLine(f.FullName);
}
FileInfo[] f2 = di.GetFilesRegExp(@"^[Zz].*$");
foreach(FileInfo f in f2)
{
Console.WriteLine(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
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...
9
by: MJ | last post by:
HI I want to know what is mean by regular expression in C Mayur
4
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...
2
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...
2
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...
4
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...
7
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...
20
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...
3
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...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.