Let us say I have the following string: "Algorithms 1" by Robert Sedgewick
. This is input from the terminal.
The format of this string will always be:
1. Starts with a double quote
2. Followed by characters (may contain space)
3. Followed by double quote
4. Followed by space
5. Followed by the word "by"
6. Followed by space
7. Followed by characters (may contain space)
Knowing the above format, how do I read this?
I tried using fmt.Scanf()
but that would treat a word after each space as a separate value. I looked at regular expressions but I could not make out if there is a function using which I could GET values and not just test for validity.