Recently I learned about a new way to escape strings in rust using the r##"hello world"## syntax. And it got me thinking wouldn't it be useful to be able to quickly find all the string literals in a rust file? So how would one go about doing this? Well turns out there is a tool exactly for this purpose! RegEx is a tool for finding strings in files! So please write a Reg-Ex that matches all string literals in a rust file. To keep things simple for now we ignore comments (Not that my code has any to begin with), also no chars ('k') or byte strings (b"hello"). An example is shown bellow:
Should match the following two substrings
Note that the quotes are included in the match. Also we use a single global match command meaning you don't have to worry about overlapping matches since it starts searching at the end of the last match
The longer rust file can be found here as well as a list of matches seperated by 2 new lines
Rust code MatchesEnter your Reg-Ex bellow, don't include flags. The browser uses the ECMA flavor of RegEx
There is one crucial RegEx feature you may not know exists, the first hint only tells you of its existence:
Need another hint? Click below:
More hints? Click below:
Final Hint? Click below: