≡ Menu

regular expression

How do I redirect old ugly urls such as http://example.com/store/view.jsp?product=foo with clean url - http://example.com/store/view/product/foo using nginx reverse proxy?
[click to continue…]

WordPress Rename Image URL For a CDN Usage

Recently, we moved all our static assets to a CDN (Content Delivery Network) as described here. However, we have over 8000+ old blog posts and we need to point static images url to our CDN account hosted at http://MyACCOUNT.cloudfront.net/images/ folder. How do I rename all image urls stored in wordpress posts? How do I offload static images to a CDN urls under WordPress?
[click to continue…]

Regular Expressions In grep

How do I use the Grep command with regular expressions on a Linux and Unix-like operating systems?
[click to continue…]

How do I search multiple strings or words using the grep command? For example I'd like to search word1, word2, word3 and so on within /path/to/file. How do I force grep to search multiple words?
[click to continue…]

sed: Remove All Digits / Input From Input

Q. How do I remove all digits or number from my text file or input using sed command?
[click to continue…]

Q. I'm using lighttpd under CentOS 5 and getting the following error:
...can't handle '$HTTP[url] =~ …' as you compiled without pcre support.

My question is What is pcre support, and how do I solve this problem?

A. Pcre is nothing but Perl-compatible regular expression library. PCRE has its own native API, but a set of "wrapper" functions that are based on
the POSIX API are also supplied in the library libpcreposix. You must compile lighttpd with pcre to support lighttpd regex style config option. pcre-devel package provides the development files (Headers, libraries for static linking, etc) for pcre. Install the following package and rebuild your lighttpd:
# yum install glib2-devel openssl-devel pcre-devel bzip2-devel gzip-devel

Now change directory to lighttpd source code and recompile Lighttpd with pcre option:
# make clean
# ./configure
# make
# make install

Now restart lighttpd and it should support pcre style config options.

How do I remove all (text, special characters, white spaces, tabs etc) from my text file (input) except numbers (digits) using sed command?
[click to continue…]