Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2.2 The * Special Character

As we mentioned * is a regular expression special character. The * is used to indicate that zero or more of the previous characters should be matched. Thus, the regular expression a* will match any string that contains zero or more a's.

Note that since a* will match any string with zero or more a's, a* will match all strings, since all strings (including the empty string) contain at least zero a's. So, a* is not a very useful regular expression.

A more useful regular expression might be baa*. This regular expression will match any string that has a b, followed by one or more a's. Thus, the set of strings we are matching are those that contain ba, baa, baaa, etc. In other words, we are looking to see if there is any "sheep speech" hidden in our text.

  Published under the terms of the GNU General Public License Design by Interspire