redet – build regular expression (regex) for any program.

2010-06-04 1 min read Fedora
Even if someone is a regex guru there are times that people get confused with some regular expression and want to either test it out or want to some help. Behold, redet is here. Lets start with installing redet: sudo yum install redet Once you are done with installation, just run it with redet. First you need to load the sample data, select your program and then enter the regex to test it out. Continue reading

Detecting URLs in a Block of Text

2010-03-31 4 min read bash
Jan Goyvaerts on <a href="http://www.regex-guru.info/2008/11/detecting-urls-in-a-block-of-text/" target="_blank">Detecting URLs in a Block of Text In his blog post <a href="http://www.codinghorror.com/blog/archives/001181.html">The Problem with URLs points out some of the issues with trying to detect URLs in a larger body of text using a regular expression. The short answer is that it can’t be done. Pretty much any character is valid in URLs. The very simplistic <span class="regex">\bhttp://\S+ not only fails to differentiate between punctuation that’s part of the URL, and punctuation used to quote the URL. Continue reading

grep -v with multiple patterns.

2010-01-25 1 min read bash Linux
$ sed '/test/{/error|critical|warning/d}' somefile If you wanted to do all in one command, you could go w/ sed instead <a href="http://www.commandlinefu.com/commands/view/3882/grep-v-with-multiple-patterns.">View this command to comment, vote or add to favourites <a href="http://feeds2.feedburner.com/commands/by/pipping">View all commands by <a href="http://feeds2.feedburner.com/commands/by/pipping">pipping <a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="" align="bottom" /> by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com) <a href="http://feedads.g.doubleclick.net/~a/J5B2Z5VTSlqhmd-2YMQ4ndmAu4U/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/J5B2Z5VTSlqhmd-2YMQ4ndmAu4U/0/di" alt="" align="bottom" /> <a href="http://feedads.g.doubleclick.net/~a/J5B2Z5VTSlqhmd-2YMQ4ndmAu4U/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/J5B2Z5VTSlqhmd-2YMQ4ndmAu4U/1/di" alt="" align="bottom" /> <img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/LjKzo7FpzDU" alt="" width="1" height="1" align="bottom" /> URL: <a href="http://feedproxy. Continue reading