Refactoring the use of regex in screenshot [JacoPretorius]