I ran this simple program:
#include <iostream>
#include <string>
using namespace std;
#include <boost/regex.hpp>
int main ()
{
// boost::regex fullname_regex ("[A–Z]+[a–z]*, [A-Z][a–z]*");
boost::regex fullname_regex ("[A-Z]+[a-z]*, [A-Z][a-z]*");
string name;
cout << "Enter you full name: " << flush;
getline (cin, name);
if (! regex_match (name, fullname_regex))
{
cout << "Error: name not entered correctly" << endl;
}
return 0;
}
which I just copied from somewhere. When I uncomment the commented line (part of the original copy/paste) and comment the next one (typed by myself) the program always rejects the name. Otherwise it works as expected. I am using vim. I did :set list to see hidden characters and the lines are identical. I inserted a long comment before the original line in order to move it down, suspecting a disk fault (very old system), but still I got the same error. This is an ubuntu server with no gui, I use putty to do this. I am not accustomed with such problems under linux, if anybody has any idea about what could explain this strange behaviour, please let me know. Maybe vim still uses some options from the original page, which is here and is formatted, indeed, but :set list does not show them?
The dashes are not the same. The commented ones are longer and represented by different characters and thus interpreted differently. Common Copy+Paste error.
http://en.wikipedia.org/wiki/Dash
That - character in the commented out line is U+2013 EN DASH, not the ASCII dash U+002d.
Because of the limited bitmap font I'm using, the Unicode character already stuck out when opening the file, but you can use the g8 command to print the UTF-8 encoding values of the character under the cursor, or use :call search('[^\x00-\x7F]') to locate the next non-ASCII character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With