Re: [Dev-C++] Choose a word from a .txt file
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Pranav N. <pr...@pr...> - 2008-06-03 09:44:28
|
I think what Per refers to is the overhead of initializing and regex library and calling upon it. What appears as a single function call is probably several 100 lines of code underneath. And for small programs it's often better to leave out library dependencies and reduce compilation times. Just my 2 cents. Pranav Negandhi www.pranavnegandhi.com >> 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. > |