a peek into my MIND

August 31, 2012

cd to script directory

Filed under: General — Bharat Kondeti @ 11:06 pm

One way to change directory to executing script location…

#!/bin/sh</code>

cd "$(dirname ${BASH_SOURCE[0]})"

August 29, 2012

Regular expression to match any character including new line

Filed under: Tools — Bharat Kondeti @ 7:27 pm

Thought (.*) would match any character, but realized that it does except for new line character. For example if you want to write regular expression to validate length of a text in comments text box to be less than 500 characters then we need to write a regular expression something like..


^(.|\n){0,500}$

Try this on a free online editor http://regexpal.com/

Blog at WordPress.com.