Re: Searching for a string in a text buffer with a regular expression

2013-12-09 Thread maxpat78
I mean a code fragment like this: foreach(i; 1..2085) { // Bugbug: when we read in the buffer, we can't know anything about its encoding... // But REGEX could fail if it contained unknown chars! Latin1String buf; string s;

Re: Searching for a string in a text buffer with a regular expression

2013-12-06 Thread Shammah Chancellor
On 2013-12-06 08:53:04 +, maxpat78 said: While porting a simple Python script to D, I found the following problem. I need to read in some thousand of little text files and search every one for a match with a given regular expression. Obviously, the program can't (and it should not) be ce

Re: Searching for a string in a text buffer with a regular expression

2013-12-06 Thread bearophile
maxpat78: Is there a simple and elegant solution in D for such case? Python didn't gave such problems! Do you mean Python3? Bye, bearophile

Searching for a string in a text buffer with a regular expression

2013-12-06 Thread maxpat78
While porting a simple Python script to D, I found the following problem. I need to read in some thousand of little text files and search every one for a match with a given regular expression. Obviously, the program can't (and it should not) be certain about the encoding of each input file.