Click here to Skip to main content
15,923,051 members
Home / Discussions / C#
   

C#

 
GeneralRe: Buttons on C# sharp app now cause System sounder to beep! Pin
glennPattonWork320-Jun-12 21:49
professionalglennPattonWork320-Jun-12 21:49 
QuestionConvert PDF to Word using C# Pin
nvarunkumar19-Jun-12 22:52
nvarunkumar19-Jun-12 22:52 
AnswerRe: Convert PDF to Word using C# Pin
Hum Dum19-Jun-12 23:00
Hum Dum19-Jun-12 23:00 
AnswerRe: Convert PDF to Word using C# Pin
Pete O'Hanlon19-Jun-12 23:05
mvePete O'Hanlon19-Jun-12 23:05 
AnswerRe: Convert PDF to Word using C# Pin
Richard MacCutchan20-Jun-12 3:18
mveRichard MacCutchan20-Jun-12 3:18 
QuestionC# 2010 delete from database Pin
sc steinhayse19-Jun-12 17:09
sc steinhayse19-Jun-12 17:09 
AnswerRe: C# 2010 delete from database Pin
Pete O'Hanlon19-Jun-12 23:18
mvePete O'Hanlon19-Jun-12 23:18 
QuestionH.264 decode without stream Pin
Medvezhonok19-Jun-12 12:31
Medvezhonok19-Jun-12 12:31 
QuestionHow To Parse This String Pin
Kevin Marois19-Jun-12 9:53
professionalKevin Marois19-Jun-12 9:53 
AnswerRe: How To Parse This String Pin
PIEBALDconsult19-Jun-12 10:40
mvePIEBALDconsult19-Jun-12 10:40 
GeneralRe: How To Parse This String Pin
Kevin Marois19-Jun-12 10:42
professionalKevin Marois19-Jun-12 10:42 
GeneralRe: How To Parse This String Pin
Dave Kreskowiak19-Jun-12 11:08
mveDave Kreskowiak19-Jun-12 11:08 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 11:20
mvePete O'Hanlon19-Jun-12 11:20 
GeneralRe: How To Parse This String Pin
Kevin Marois19-Jun-12 11:38
professionalKevin Marois19-Jun-12 11:38 
AnswerRe: How To Parse This String Pin
Paul Conrad19-Jun-12 12:20
professionalPaul Conrad19-Jun-12 12:20 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 12:33
mvePete O'Hanlon19-Jun-12 12:33 
GeneralRe: How To Parse This String Pin
PIEBALDconsult19-Jun-12 12:48
mvePIEBALDconsult19-Jun-12 12:48 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 22:28
mvePete O'Hanlon19-Jun-12 22:28 
GeneralRe: How To Parse This String Pin
PIEBALDconsult20-Jun-12 3:32
mvePIEBALDconsult20-Jun-12 3:32 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon20-Jun-12 3:48
mvePete O'Hanlon20-Jun-12 3:48 
GeneralRe: How To Parse This String Pin
PIEBALDconsult19-Jun-12 12:36
mvePIEBALDconsult19-Jun-12 12:36 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 12:39
mvePete O'Hanlon19-Jun-12 12:39 
GeneralRe: How To Parse This String Pin
Kevin Marois19-Jun-12 12:48
professionalKevin Marois19-Jun-12 12:48 
GeneralRe: How To Parse This String Pin
Pete O'Hanlon19-Jun-12 22:48
mvePete O'Hanlon19-Jun-12 22:48 
GeneralRe: How To Parse This String Pin
Kevin Marois20-Jun-12 5:49
professionalKevin Marois20-Jun-12 5:49 
[EDIT] - Never mind. I'm stupid. I changed it to...

MatchCollection matches = regex.Matches(Line);


Now it works.



Thanks for the code. I'm still getting nothing in the collection. Here's my code:

var Line = "Dev: 0 Model: TOSHIBA MK3265GSX   Serial: 20FDF20WS  FW: GJ002H STW: 0 MaxLBA: 625142447 FDESUPPORTED: 0 PREBOOT: 0 DRIVETRUSTENABLED: 0 DRIVETRUSTSUPPORTED: 0 w128: 41 FULLFW: GJ002H SERVOFW:  SDLSUPPORTED: 1 PLATFORM: 0 SAFE: 1 DSTTIMEOUT: 103 ISBOOTORSYSTEM: 1";
var WordToFind = "Model";

Regex regex = new Regex("(?:(?'Key'\\S+): (?'Value'.*?))",
                    RegexOptions.RightToLeft |
                    RegexOptions.CultureInvariant |
                    RegexOptions.Compiled);

MatchCollection matches = regex.Matches(WordToFind);

foreach (Match match in matches)
{
    Console.WriteLine("Key: {0} - Value: {1}", match.Groups["Key"], match.Groups["Value"]);
}


I'm guessing the regex string is wrong, but kI really don't knnow.
If it's not broken, fix it until it is

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.