Bizarre question in CS intro class

Part of my intro to CS class is access to "my programming lab" which is a collection of questions relating to the text. This question is supposed be related to section 6.1 of Savitch's "Problem Solving with C++". The section is titled "Why use files for I/O?" and has nothing to do with strings. I can't find any mention of anything like this in the text, anywhere. Since I'm new to C++, I could just be missing the key words.

The question:

Which string does NOT match the regular expression: "v.x.*"?

v.x.*
vx
v.x
vxxxxxxx
vvx

Through trial and error I get the answer to be "vx". I do not understand this at all from my experience with wildcards in DOS, Unix, etc. Please educate me!

Jim
Last edited on
Wow no one has an idea what this question is about huh?
You could email your Professor to clarify the question or ask a class mate.
This question has nothing to do with files or I/O.
In a very technical sense, it does have to do with strings, but not c-strings or std::string.

The question is specifically about regular expressions, which you should spend some time reading about. Pretty good introductions can be found at http://regexone.com/ and http://www.bsd.org/regexintro.html.

You are correct, because v.x.* requires a minimum of three characters to match.

The first character must be a 'v'. v
The second character can be anything. .
The third character must be an 'x'. x
Zero or more of any characters may follow. .*

Hope this helps.
Thanks Duoas, the answer must be wrong.
No, I agreed that your answer was correct, because it has only two characters. Please read carefully.
Topic archived. No new replies allowed.