March 18, 2015 6:54 am

Regular Expression in Web Programming

Do you ever have developed websites software based on user input, but not found an easy way to make sure the input entered by the user is the desired output? Or maybe you need to change a word that recurs in various revisions   hundred times within a document of tens of thousands of words? To overcome these problems and many other problems developed language that enables advanced analysis of text: language of regular expressions.

Regular Expression in Web Programming 2015

What is a regular expression

Regular expression is also called Regular Expression or RegEx for short is a string of characters in (series) used to define search patterns. You can think of regular expressions as a replacement for the wildcard system known to us from DOS or unix-based operating systems.

For example the wildcard system you can search for all files with the extension exe by entering the string *.exe

search bar  used  character .* is apply anywhere so you can find files without entering the name of the file, mostly we defining a general template – each file whose name matches the pattern is highlighted and displayed in search results. Similarly, this can be done by the following regular expression *\.exe$

Regular expressions are a powerful tool and rich text options used to analyze a variety of fields. The common uses of this tool include syntax highlighting syntax highlighting, validation as  it was doing in digital forms,  Advanced Search Engine Optimization.  if they are  support it that would be much more. There are even programming languages ​​that use regular expressions as part of the compilation (compile) their own.

However – text analysis can be done using regular expressions is limited and there are things that can be done with the help, for example, analysis of the HTML.


The term “expression Rgolri” was invented in 1956 by Stephen Cole Kleene developed as part of the language, that used mathematical characters, but the concept never broke into the public consciousness until 1968. This year began to be used in regular text and bitis for lexical analysis lexical analysis  as part of the compilation process of certain programming languages. Today, most programming languages ​​offer support regular bitis part of their standard libraries, including PHP,Java, Python, JavaScript and more. There are languages ​​are part of regular expressions and their syntax, such as Perl.

The regular expression / (? <= \.) {1} (? = [AZ]) / g finds all the spaces after and before a capital letter.

Regular Expression in Web Programming

A regular expression consists of a sequence of characters, as some of them spaces (special) meaning in text analysis and the other has no special meaning and is literally turn.
For example, the expression mu[zs]ic
Finds the word “music” and the word “muzik”. The square brackets [] have special meaning in a regular expression that (they define group), but the other letters have special meaning.

The expression colour?

Find two versions of the English word “color” and “colour”. A question mark has a special meaning: it refers to the character that precedes it, and accepts 1 or 0 characters from that character.

There are many special characters that can be used in expressions and text analysis which makes it much simpler and achievable. The guide below will explain each of these characters, along with examples on how to use them.

Useful tools

Before I would  go  to the conclusion of Regular expressions, I wanted to share some tools those  mostly used during web programming  when it comes to text analysis or even to test the regular expressions?. The first web site  -offering you run regular expressions in real time on their looks, which on the entered text. Except for simple and convenient interface, the site also offers an explanation for the regular expression entered and the documents containing all the rules of the language.

Another quality web site is which has also run lectured for regular expressions and auxiliary documents. Unlike the old site which uses the regex engine of the JavaScript language for simulation, this site allows you to choose which search engine to use. As of writing this article, the engines that are supported on this website are those of the languages JavaScript, Python and PHP.

Author Illahi Bux

A freelance Web & Mobile Developer, specialising in PHP and open source Project Rescue, professional training and coaching for a variety of clients both near and far to grow your business. Illahi Bux is a founder of, find him on Twitter

Tutorial Categories: