473,580 Members | 2,837 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regex matching question

Hi,

I'm creating a little knowledge base webservice, which would help my users
when they
encounter errors.

In my knowledge base I would have entries like this:
problem: Can't access file[*] because it is being used by another process
fix: the file is currently in use so you can't use it now.

Lets say an IOException is thrown in the application with the message:
"Can't access file 'myfile.txt' because it is being used by another process"

The error would then be sent to the webservice, the webservice would
try to match the error message with the kbase and send back the response
if one is found.

My guess is this would be best done with regular expressions, right?

Please help,
thanks,
saso


Feb 20 '06 #1
3 1124
Saso Zagoranski <sa************ *@guest.arnes.s i> wrote:
I'm creating a little knowledge base webservice, which would help my users
when they
encounter errors.

In my knowledge base I would have entries like this:
problem: Can't access file[*] because it is being used by another process
fix: the file is currently in use so you can't use it now.

Lets say an IOException is thrown in the application with the message:
"Can't access file 'myfile.txt' because it is being used by another process"

The error would then be sent to the webservice, the webservice would
try to match the error message with the kbase and send back the response
if one is found.

My guess is this would be best done with regular expressions, right?


Yes, that sounds like a good fit for regular expressions. One thing to
bear in mind, however, is that regular expressions can be difficult to
write. Will you be the person writing all the knowledge base entries,
and are you comfortable with regular expressions (or happy to learn
about them)?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 20 '06 #2
Hi,

I will be the person who will write kbase entries and all of them
will be in the form:
text text[*] text text text
where[*] represents an any text. (I can use something else instead of[*]
if you
think it's better)

I don't have any knowledge of regex but I am willing to learn,
although I have to admit that I was hoping that there is an example out
there of how to do
what I'm looking for :)

thanks for your answer,
saso

"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
Saso Zagoranski <sa************ *@guest.arnes.s i> wrote:
I'm creating a little knowledge base webservice, which would help my
users
when they
encounter errors.

In my knowledge base I would have entries like this:
problem: Can't access file[*] because it is being used by another
process
fix: the file is currently in use so you can't use it now.

Lets say an IOException is thrown in the application with the message:
"Can't access file 'myfile.txt' because it is being used by another
process"

The error would then be sent to the webservice, the webservice would
try to match the error message with the kbase and send back the response
if one is found.

My guess is this would be best done with regular expressions, right?


Yes, that sounds like a good fit for regular expressions. One thing to
bear in mind, however, is that regular expressions can be difficult to
write. Will you be the person writing all the knowledge base entries,
and are you comfortable with regular expressions (or happy to learn
about them)?

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Feb 20 '06 #3
Saso Zagoranski <sa************ *@guest.arnes.s i> wrote:
I will be the person who will write kbase entries and all of them
will be in the form:
text text[*] text text text
where[*] represents an any text. (I can use something else instead of[*]
if you think it's better)

I don't have any knowledge of regex but I am willing to learn,
although I have to admit that I was hoping that there is an example out
there of how to do what I'm looking for :)


Well, to do that, you could just convert the text into a regular
expression by escaping the bits at the start and end (so it doesn't
matter if you've got something which is special to regular expressions)
and replace the[*] with something like .* (which matches any
characters, basically).

You *could* do all that by splitting the string into a start bit and an
end bit, then using string.StartsWi th and string.EndsWith . However,
things would get hairy if you then found yourself with two[*] tokens.

I suggest you read the MSDN pages on regular expressions - they're
worth delving into.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 20 '06 #4

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

Similar topics

4
2134
by: aeuglein | last post by:
Hello! I have this RegEx: /(+:\/\/+)/i Now, I want to exlude on the end of a String the formats .gif / .jpg / ..png / .exe / .zip / .rar How I can this add to my regex ?
7
5716
by: alphatan | last post by:
Is there relative source or document for this purpose? I've searched the index of "Mastering Regular Expression", but cannot get the useful information for C. Thanks in advanced. -- Learning is to improve, but not to prove.
17
3954
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher http://forta.com/books/0672325667/
5
2419
by: Kofi | last post by:
Any takers? Got a string of DNA as an input sequence GGATGGATG, apply the simple regex "GGATG" as in Regex r = new Regex("GGATG", (RegexOptions.Compiled)); MatchCollection matches = r.Matches("GGATGGATG"); Now I would expect to get two matches right? One at index 0 in the
8
2580
by: Bob | last post by:
I need to create a Regex to extract all strings (including quotations) from a C# or C++ source file. After being unsuccessful myself, I found this sample on the internet: @"@?""""|@?"".*?(?!\\).""|''|'.*?(?!\\).'" I am inputting the entire source file string and using it with RegexOptions.Singleline. This works OK with, unless the...
7
1523
by: CB | last post by:
Trying to match the entire following object literal code using a RegEx. var Punctuators = { '{' : 'LeftCurly', '}' : 'RightCurly' } Variations on the idea of using /var.*{.*}/ of course stops at the first }. Any ideas? Thanks in advance.
6
5870
by: Martin Evans | last post by:
Sorry, yet another REGEX question. I've been struggling with trying to get a regular expression to do the following example in Python: Search and replace all instances of "sleeping" with "dead". This parrot is sleeping. Really, it is sleeping. to This parrot is dead. Really, it is dead.
0
1538
by: Tidane | last post by:
Visual Basic.NET Framework 2.0 I've created a program to parse out text as the program recieved it and use Regex matching to decide what should be done. My problem is that the text is matching when it shouldn't be, if that makes any sense. If Regex.IsMatch(Text, "You find (a|an)" & MoneyMatch) Then Other code here that doesn't matter....
4
312
by: pedrito | last post by:
I have a regex question and it never occurred to me to ask here, until I saw Jesse Houwing's quick response to Phil for his Regex question. I have some filenames that I'm trying to parse out of URLs. (href=("|')http://.www\.thesite\.com/.{1,7}/)(?<filename>.) This generally works, but the problem is some of the image files have ..th.jpg...
3
177
by: Jeff | last post by:
I'm parsing this: name="value" and sometimes it looks like this: name2="value2 without the closing '"'. I don't want to capture the end quote.
0
7854
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...
0
7783
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...
0
8296
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7878
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...
1
5665
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3806
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2295
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
1
1394
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1118
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...

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.