TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jay S
NA
230
59.4k
[C#] Match all cases of a string
Jan 16 2014 6:46 AM
Hi All,
I have a Array of bytes which I am trying to find all the matches of a specific string and store the location (index) of where its found in a list.
So far I have:
using (BinaryReader br= new BinaryReader(File.Open(this.path, FileMode.Open), Encoding.ASCII))
{
byte[] Name1 = br.ReadBytes(5000000);
int nCount = Name1.Count();
string humanSName = "Foo";
List<int> matches = new List<int>();
for (i = 0; i < nCount; i++)
{
Match mdiv = Regex.Match(Encoding.ASCII.GetString(Name1), humanSName);
if (mdiv.Success)
{
int xx = mdiv.Index;
matches.Add(xx);
}
}
}
This doesn't seem to work as it only ever matches the first one it finds...like its almost started off back at the start of the byte array.
Any help would be appriciated.
Reply
Answers (
1
)
check mobile no is DND Register or not
Create dynamic subdomain like path using URL Rewriting