Regular Expressions - Introduction

Qedit 5.7 for HP-UX

Home Previous Next


Introduction

Regular expressions might look like wildcards used in the Pattern search option. Regular expressions are sometimes compared to wildcards but, in fact, they are much more powerful and can be much more complex. You have to practice in order to use them efficiently and to their full potential. For brevity, we will often refer to regular expressions simply as regexp.

In Qedit's line-mode, you can use regular expression in most places where you can use a string or pattern. In fact, you specify regular expressions in Qedit similar to the way you specify patterns, by specifying the "regexp" keyword in a window:

/list "Robel+e"(regexp)  {Robelle or Robele}
/change "[rR]obel+e?"(reg) "ROBELLE"  {robell Robele...}

Although all regexp implementations share a basic set of metacharacters and syntax rules, other tools and programs might have different extensions and variations than Qedit. For example, the alternation metacharacter "|" (equivalent to an "or" function) is not provided in Qedit. As the first implementation of regular expressions in Robelle products, this version of Qedit might not have all the extensions you are currently familiar with. We will be looking at other tools as we explore the possibility of extending our own implementation in future releases.

If you are interested in learning more about regular expressions, you should get a copy of Mastering Regular Expressions written by Jeffrey E. F. Friedl and published at O'Reilly & Associates, Inc. This book covers most regular expression implementations, the differences between each one, how most regexp engines work and some tips on how to get the best performance from each type.


Home Previous Next