Showing posts with label regex. Show all posts
Showing posts with label regex. Show all posts
Wednesday, April 27, 2016

Regex Recipe: Normalize URL

This recipe describes how to replace multiple slashes in URL & avoid replacing the first // in http:// & https://.

Expected behaviour

To send some concatenated url with multiple slashes and recive the clean one.

Given Input:
http://devcdn.some-hub.net/html5//280131/publish///brand/bundle/games/
Expected Output:
http://devcdn.some-hub.net/html5/280131/publish/brand/bundle/games/
Friday, October 23, 2015

Keynote: Regexp Short Notes

Regular expressions

Regular expression is a pattern describing a certain amount of text. So, Regexps are quite useful whatever programming language u're using.