This quiz is all about learning so you will not be penalised for any wrong answers. Just keep trying until you get everything right!

1. Given the following input:Hello world!What is the output from the following command?insert "foo" before every "l"





Correct!
Hmm, that’s not right. The command states that “foo” should be inserted before every “l”. This output only has a “foo” inserted before one or more “l”. You could replicate this output with the command insert "foo" before every regex "l+"
Hmm, that’s not right. The command states that “foo” should be inserted before every “l”. This output has a “foo” inserted only before an “l” on its own. You could replicate this output with the command insert "foo" before every regex "(?<!l)l(?!l)"
Hmm, that’s not right. The command will produce one of the outputs above.

2. Which of the following commands will not produce the same output as the following command?insert "foo" at start





Correct! The input starts at position 0, not position 1.
Hmm, that’s not right. Inserting text before the first character is the same as inserting text at the start.
Hmm, that’s not right. Prefixing text is the same as inserting text at the start.
Hmm, that’s not right. One of these commands does not match the command in question.

3. Given the following input: HeLlO WoRlD! What needs to be changed in this command insert "foo" before every "o" to produce the following output? HeLlO WfoooRlD!





Correct! We want to match with the lowercase “o” and not the uppercase “O”. By default Rewrite will ignore case when checking for matches unless you use the xcase modifier.
Hmm, that’s not right. This change won’t make any difference to the output as Rewrite ignores case when checking for matches by default.
Hmm, that’s not right. This change won’t make any difference to the output as Rewrite ignores case when checking for matches by default (even for regular expressions).
Hmm, that’s not right. This command will match with both the uppercase “O” and the lowercase “o” in the input unless we specify otherwise. This command will return HeLlfooO WfoooRlD!

4. You were given the following text by a colleague, however you noticed that they forgot to add a space after one of the commas.

Lorem ipsum dolor sit amet,consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
You also happen to know the regular expression ,(?! ) which will find all commas not followed by a space. Which command should you use below to add the missing space to the text and nothing else?





Correct! This command will add a space after every comma which is not already followed by a space.
Hmm, that’s not right. This will add the missing space after amet,, however it will also add an additional space after elit,. As there is already a single space after elit,, there will now be two spaces after the word (elit,  sed). This is not an ideal solution.
Hmm, that’s not right. This command will insert a space after the literal word “,(?! )”. We want it to match with the regular expression (regex), not the word itself.
Hmm, that’s not right. The xcase modifier will make sure it matches with the actual case of the word “,(?! )”. We want it to match with the regular expression (regex), not the word itself.