Re: [Dev-C++] Choose a word from a .txt file
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Münt, B. <Ber...@eu...> - 2008-06-03 09:35:37
|
> No regular expressions if he is looking for an exact match. Regular > expressions are there to look for patterns. Normal > strcmp()/strncmp() is > faster when looking for exact matches. No not at all. You explained an algorithms to look in the middle, then depending on less or greater in the lower half or in the upper half etc. That needs a lot of lookups if the file is huge. A regex with the multiline option can find the answer with one line. /^WordToFind\s*?(.*)/m In the caption(1) you will find the answer, if there is an answer. Regards, BM |