Click here to Skip to main content
14,880,336 members
Home / Discussions / C#


QuestionRegex Problem Pin
musefan26-Feb-09 8:35
Membermusefan26-Feb-09 8:35 
Hi all,

I am having a little trouble with Regex.

Basically i have a text file that i am trying to parse.

In this file i know there will be a number of names, these names will always use 100 bytes of space, if the name, in plain ASCII code, is less then 100 bytes the remainder of the space is filed with 0xFF

My regex code is as follows.

streamreader sr = new streamreader("file.txt");
string text = sr.ReadToEnd();

string pattern = @"[A-Za-z0-9]|\xFF{100}";

Regex = new Regex(pattern);

foreach(Match match in Regex.Matches(text))
   //not getting the result i expect, which i can clearly see if a HexEditor


I think the problem is with the \xFF part of the program, as a simple regex expression such as @"\xFF" returns no where near as many 0xFF values as are present in the file

Thanks for any help

If only MySelf.Visible was more than just a getter...

A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting

AnswerRe: Regex Problem Pin
PIEBALDconsult26-Feb-09 9:01
professionalPIEBALDconsult26-Feb-09 9:01 
GeneralRe: Regex Problem Pin
musefan26-Feb-09 10:15
Membermusefan26-Feb-09 10:15 
AnswerRe: Regex Problem Pin
Luc Pattyn26-Feb-09 11:01
sitebuilderLuc Pattyn26-Feb-09 11:01 
GeneralRe: Regex Problem Pin
PIEBALDconsult26-Feb-09 12:46
professionalPIEBALDconsult26-Feb-09 12:46 
GeneralRe: Regex Problem Pin
musefan26-Feb-09 23:53
Membermusefan26-Feb-09 23:53 
AnswerRe: Regex Problem Pin
Luc Pattyn27-Feb-09 1:26
sitebuilderLuc Pattyn27-Feb-09 1:26 
GeneralRe: Regex Problem Pin
musefan27-Feb-09 1:44
Membermusefan27-Feb-09 1:44 
AnswerRe: Regex Problem Pin
Luc Pattyn27-Feb-09 1:51
sitebuilderLuc Pattyn27-Feb-09 1:51 
GeneralRe: Regex Problem Pin
musefan27-Feb-09 2:06
Membermusefan27-Feb-09 2:06 
GeneralRe: Regex Problem Pin
PIEBALDconsult27-Feb-09 4:36
professionalPIEBALDconsult27-Feb-09 4:36 

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.