This gist has an educational excerpt of code I made while completing the Coding Trainer educational tool. Since there were multiple JavaScript files that needed to access the same value, the solution was devised with a regular expression. While using JavaScript, in order to read the values in a string for the characters per minute (cpm/CPM), a regular expression was used to search for patterns in the given string and return the CPM.
Within the Coding Trainer educational tool, users may type lines of code to determine and improve their typing speed. The typing speed is calculated as a CPM value and the result is then added on the screen by using textContent()
on an element with an id of #score
. Additional metrics like the total correct characters and total incorrect characters are also shown on the screen. After the CPM is shown (and retrie