473,396 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 1109
Saso Zagoranski <sa*************@guest.arnes.si> 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.com>
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.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Saso Zagoranski <sa*************@guest.arnes.si> 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.com>
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.si> 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.StartsWith 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.com>
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
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
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...
17
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 ...
5
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 =...
8
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: ...
7
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...
6
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"....
0
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...
4
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...
3
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.