I am just starting to learn javascript, so I don't have the skills to figure out what I assume is a trivial problem.
I'm working with a Wordpress blog that serves as a FAQ for our community and I am trying to pull together some tools to make managing the comments easier. Internet Duct Tape's Greasemonkey tools, like Comment Ninja, are helpful for most of it, but I want to be able to get a list of all the IP addresses that we're getting comments from in order to track trends and so forth.
I just want to be able to select a bunch of text on the comments page and click a bookmarklet (http://bookmarklets.com) in Firefox that pops up a window listing all the IP addresses found in the selection.
Update:
I kind of combined a the answers from levik and Jacob to come up with this:
javascript:ipAddresses=document.getSelection().match(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g).join("<br>");newWindow=window.open('', 'IP Addresses in Selection', 'innerWidth=200,innerHeight=300,scrollbars');newWindow.document.write(ipAddresses)
The difference is that instead of an alert message, as in levik's answer, I open a new window similar to Jacob's answer. The alert doesn't provide scroll bars which can be a problem for pages with many IP addresses. However, I needed the list to be vertical, unlike Jacob's solution, so I used the hint from levik's to make a
for the join instead of levik's \n.
Thanks for all the help, guys.