Question: Given a list of divs, I need to be able to use the up and down arrow keys to navigate between items in the list, apply an `.ag-menu-option-active` class to the currently selected item, and on `Enter` key, trigger a click on the currently selected list item. 

I'm currently able to iterate over the list of items, but on down arrow, it only logs out the second item in the list. As stated above, the user should be able to move up and down the list and have the active class applied to the currently selected item. When the user hits the `Enter` key, the associated list item should be clicked.

```
let columnMenuItems = document.querySelectorAll('.ag-menu-option');
document.addEventListener('keydown', e => {
  if (e.key === 'ArrowDown') {
    for (let i = 0; i < columnMenuItems.length; i++) {
      if (columnMenuItems[i].classList.contains('ag-menu-option-active') === true) {
        console.log("MENU OPTION SELECTED: ", columnMenuItems[i + 1])
        columnMenuItems[i].click();
        break;
      }
    }
  }
});

```

**JSFiddle link: [link](http://jsfiddle.net/5anhuo0k/23/)**

Answer: 
You can use PowerShell's `-replace` operator, which uses regular expressions:

```
$newstring = $domain -replace '^[^.]*'

```

If you're wondering about the lack of the replacement string, that is optional in PowerShell; above code is functionally identical to

```
$newstring = $domain -replace '^[^.]*', ''

```
If you are seeking only the TLD (.com, .org, .gov, etc.), then you can use -replace with a capture.

```
PS C:\src\t> "www.myhome.org"  -replace '^[^.]*'
.myhome.org
PS C:\src\t> "www.myhome.org"  -replace '^.*(\..*)', '$1'
.org

```