Click here to Skip to main content
15,887,856 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to find the Content datatype in a String Pin
Guffa1-Aug-08 23:35
Guffa1-Aug-08 23:35 
QuestionThe reason behind the differences of this.Font = fontdialog1.Font and btnTest.Font Pin
Lim Yuxuan1-Aug-08 18:37
Lim Yuxuan1-Aug-08 18:37 
AnswerRe: The reason behind the differences of this.Font = fontdialog1.Font and btnTest.Font Pin
Gideon Engelberth2-Aug-08 2:12
Gideon Engelberth2-Aug-08 2:12 
GeneralRe: The reason behind the differences of this.Font = fontdialog1.Font and btnTest.Font Pin
Lim Yuxuan2-Aug-08 4:56
Lim Yuxuan2-Aug-08 4:56 
QuestionAdd rular in toolbar Pin
amitshan1-Aug-08 18:13
amitshan1-Aug-08 18:13 
AnswerRe: Add rular in toolbar Pin
Krazy Programmer1-Aug-08 22:13
Krazy Programmer1-Aug-08 22:13 
AnswerRe: Add rular in toolbar Pin
Paul Conrad2-Aug-08 10:29
professionalPaul Conrad2-Aug-08 10:29 
QuestionRegex Match counting problem Pin
Mohammad A Gdeisat1-Aug-08 17:06
Mohammad A Gdeisat1-Aug-08 17:06 
Hi all

I have a problem in counting/extracting matches from a URL string using Regex:

My URL looks like this:
www.website.com/LanguageName/BookName/filename.txt

I use the following code to extract Language name and Bookname:

Match bookMatch = Regex.Match(requestString, "/[^/]*/[^$]", RegexOptions.RightToLeft);<br />
            BookInfo bookInfo = new BookInfo();<br />
            if (bookMatch.Success)<br />
            {                <br />
                //remove the forward slashes from the book name<br />
                bookInfo.BookName = bookMatch.Groups[0].Value.Substring(1, bookMatch.Groups[0].Value.Length - 3);<br />
                Match langMatch = bookMatch.NextMatch();<br />
                if (langMatch.Success) //2nd success (for the language)<br />
                {<br />
                    bookInfo.Langauge = langMatch.Groups[0].Value.Substring(1, langMatch.Groups[0].Value.Length - 3);                    <br />
                }<br />
                <br />
            }<br />
            return bookInfo;


Now the code successfully extracts Bookname as it is rightmost in the expression, let us assume that we have the following URL:

www.website.com/LanguageName/BookName/filename.txt
bookMatch will match "/BookName/f", so I remove the 1st one and last two characters to get the bookname correctly.

Now the langMatch doesn't catch the language in the string which should be "/LanguageName/B", it seems that this is happening becoz the 1st match (right to left) has ended at the slash "/" before the BookName, so the search for the next Match will begin on the "e" (last char) character of the LanguageName which will not result in a match.

So how to force the search for the next match to begin on the "/" between the "B" and the "e"?

Any ideas? thanks.

And ever has it been that love knows not its own depth until the hour of separation

Mohammad Gdeisat

AnswerRe: Regex Match counting problem Pin
User 66582-Aug-08 0:56
User 66582-Aug-08 0:56 
GeneralRe: Regex Match counting problem Pin
Mohammad A Gdeisat2-Aug-08 0:59
Mohammad A Gdeisat2-Aug-08 0:59 
GeneralRe: Regex Match counting problem [modified] Pin
User 66582-Aug-08 1:08
User 66582-Aug-08 1:08 
AnswerRe: Regex Match counting problem Pin
Gideon Engelberth2-Aug-08 2:22
Gideon Engelberth2-Aug-08 2:22 
QuestionLabel Text Pin
nelsonpaixao1-Aug-08 14:13
nelsonpaixao1-Aug-08 14:13 
AnswerRe: Label Text Pin
MarkB7771-Aug-08 14:45
MarkB7771-Aug-08 14:45 
AnswerRe: Label Text Pin
DaveyM691-Aug-08 21:13
professionalDaveyM691-Aug-08 21:13 
AnswerRe: Label Text Pin
Thomas Stockwell2-Aug-08 7:34
professionalThomas Stockwell2-Aug-08 7:34 
QuestionHow to use Queue.Synchronized Pin
JoeRip1-Aug-08 13:58
JoeRip1-Aug-08 13:58 
AnswerRe: How to use Queue.Synchronized Pin
Mark Salsbery1-Aug-08 14:27
Mark Salsbery1-Aug-08 14:27 
GeneralRe: How to use Queue.Synchronized Pin
JoeRip1-Aug-08 15:02
JoeRip1-Aug-08 15:02 
GeneralRe: How to use Queue.Synchronized Pin
Mark Salsbery1-Aug-08 15:12
Mark Salsbery1-Aug-08 15:12 
QuestionDataGridView Navigation (i bet it´s easy) Pin
nelsonpaixao1-Aug-08 13:29
nelsonpaixao1-Aug-08 13:29 
QuestionHow do I make this code display the contents of the stack at the top of the text box.? Pin
Angelinna1-Aug-08 12:15
Angelinna1-Aug-08 12:15 
AnswerRe: How do I make this code display the contents of the stack at the top of the text box.? Pin
Guffa1-Aug-08 12:51
Guffa1-Aug-08 12:51 
GeneralRe: How do I make this code display the contents of the stack at the top of the text box.? Pin
Angelinna1-Aug-08 13:54
Angelinna1-Aug-08 13:54 
GeneralRe: How do I make this code display the contents of the stack at the top of the text box.? Pin
Lim Yuxuan1-Aug-08 17:53
Lim Yuxuan1-Aug-08 17:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.