<v Instructor>All right.</v> In the last section, we got our test suite to red by writing two failing tests. One for this palindrome functionality detecting a punctuated palindrome and one a little more detailed touching on the implementation of that functionality, letters like this. So let's run it just to make sure we're still red. Here we go. So our task in this section is to get this test suite to green. That is to say passing. Part of the philosophy of test driven development involves getting the test to pass anyway you can. At this stage any application code that gets the test to pass is acceptable. No matter how ugly it is. Once we have a passing test suite we can make the code prettier while being confident that we're not breaking the application. All right, so let's think about how we're going to do this. Well, if you look at this application code you can see that we're comparing the process content to the reverse of the process content and the process content is just calling toLowerCase. Crucially, it's calling it on the content but if you look down here if we were to call this on the letters instead where we've removed things like spaces and punctuation then that would detect even palindromes like this one, Madam I'm Adam. Initially we'll do this in the most straightforward possible way which is just to go through the content character by character and select just the characters that are letters. Since this involves matching patterns in text. This sounds like a job for regular expressions. Let's go to our regular expression builder. Here we go. We can select Java script. And I've mentioned before that, the quick reference is usually a good place to start and indeed look at this. The exact regular expression we need is in the list of suggestions. This matches any characters between a through z lowercase or A through Z uppercase, like this. You can see here with the highlights that the letters are being highlighted, but not the punctuation or spaces. We can implement this in JavaScript using the match method on strings. We saw when we talked about regular expressions just review, suppose we wanted to say, does the capital M match this, remember slash for a literal regular expression that return something, not all that useful but recall our bang bang trick in a Boolean context. That is true. Lowercase also matches. And something like a comma does not. Let's go to the letters method and implement this in letters we can say, instead of return the content let's make an array of letters, push to that array. Every time a character matches this regular expression and then return that array joined on the empty string. This might sound a little familiar. We talked about this kind of code in the chapter on functional programming, which is also a bit of foreshadowing. Right, let's start with theLetters, equals an empty array. And then we were going to go through let's just do this the most straightforward way possible. Of course we know how to do four each now but really we're gonna go with just the simplest thing which is an old fashioned for loop. For, let i equal zero, i less than well we wanna go all the way through the content. So this is this dot content dot length i plus plus. So then what we wanna say is, if the character at position i matches a letter then we'll push that character to this array. So if this dot content, remember the charAt method accomplishes this there multiple ways to do it but we're gonna go with just the most straightforward the most basic, character At or charAt i dot match. Regular expression is going to be a through z lowercase, A through Z uppercase. If it matches then, theLetters dot push. Notice there's lots of repetition, we're not gonna worry about that at this stage. So we're gonna push this dot content dot charAt, we've just repeated this whole thing but that's okay at this stage we're just going to get it to work anyway we can and then return the letters dot join on empty space. So let's review it. For i equal zero i less than the length, increment i, if the character at the i position matches this regular expression, push it to this array and then return the array joined on space. Oops, and I put this inside the for loop didn't I, All right, let's see if this worked, look at that four passing only one failing. So the test for letters has passed. That means this actually successfully selected the letters from the string, which means there's only one thing left which is to change content here to letters. Remember, it's a method. So we have to add parentheses like that, boom, five passing. So this means that our palindrome detector can now detect true phrase like palindromes even ones that are full sentences. Like Madam I'm Adam, we can test this in the ripple by requiring the palindrome module and using it directly. We saw how to do this in the test, right here, we have required index dot JS. We have to do dot slash to tell it the path. Let's try this, plan is equal to a new phrase. Man a plan a canal, Panama. Is that a palindrome? It is, so our palindrome detector is now working. All that's left is to make the application code a little prettier.