Entry
Delphi: Search: Regular expression: How to add regular expression searching to Delphi? [Systools]
Oct 20th, 2003 19:51
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 10 October 2003 - 02:57 pm --------------------
Delphi: Search: Regular expression: How to add regular expression
searching to Delphi? [Systools]
---
Delphi 7 or lower does not have regular expression searching inbuilt.
---
But in Delphi 8, which should be 100% .NET compatible, you could use
the class libraries for regular expression search in your projects
(note: Delphi 7 has a beta .NET compiler available).
---
---
You could use the
MatchMask()
function for simple regular expressions containing the
? and * metacharacters.
---
---
You could further decide to download a readily available
Delphi library for regular expressions.
---
---
Download Library 'TRegExp' to search your strings:
http://anso.virtualave.net/delphi_stuff.htm#TRegExpr
---
---
An implementation of regular expression searching for Delphi 2 and
later. The
code is based on that presented by Kernighan & Plauger in their book
"Software Tools in Pascal" (ISBN 0-201-10342-7):
http://www.bsdg.org/swag/DELPHI/0465.PAS.html
---
---
The free downloadable TurboPower 'Systools' library,
which contains also a regular expression library.
---
To download the 'Systools' library:
http://sourceforge.net/projects/tpsystools
---
To get the documentation of 'Systools':
(see systools.pdf, chapter 15 'Regular expressions'):
http://prdownloads.sourceforge.net/tpsystools/tpsystools_docs.zip?
download
---
To install 'Systools' libraries:
unzip, goto Delphi, menu file->open project->change file extension to
package (=.dpk), navigate to directory 'packages', compile all the 4
packages for your Delphi version (e.g. xxxxd70.xxx if you own Delphi
7), click button 'Install'
---
About the 'Systools' regular expression library:
The basic idea is that you have an:
1.input file
2. output file
3. your regular expression which acts on this input file, and produces
that output file.
---
To use the 'Systools' regular expression library:
goto Delphi, menu file->open project->change file extension to project
(=.dpr), navigate to directory 'examples', then 'Delphi', open one of
the example projects (e.g. 'EXREGEX', for regular expression example).
Before you run it change the path information (menu
'Tools'->'Environment options'->tab 'Library', then add to 'Library
path' and 'Browsing path' the location on your computer of your
'source' directory of Systools (e.g. 'f:\mydownloadfiles\ddd\source;'),
then press button 'OK'). Just ignore some possible error messages for
the moment.
Then compile and run the EXREGEX example. Supply an input filename
(e.g. 'c:\temp\ddd.txt', and output filename (e.g. c:\temp\ddd1.txt').
Click e.g. on button 'Match' and supply a regular expression (e.g.
simply one of the strings which you know is present in the input file.
When clicking button 'Execute', you will then see only that line which
contains that string.)
---
---
Book: see also:
---
Kernighan and Plauger describe a Pascal implementation in their book
Software Tools in Pascal.
[book: Kernighan, Brian W. / Plauger, P. J. - software tools -
http://www.amazon.com/exec/obidos/ASIN/020103669X/qid=1065748525/sr=2-
3/ref=sr_2_3/002-0122962-7851254]
---
Julien Bucknall is director of programming at the
TurboPower Software company.
He is the author of the freeware library EZDSL, which contains the free
downloadable 'Systools' library, which contains amongs others a regular
expression library which you can add to your Delphi
Bucknall, Julian - the Tomes of Delphi: Algorithms and Datastructures -
http://www.amazon.com/exec/obidos/tg/detail/-
/1556227361/qid=1065748783/sr=1-1/ref=sr_1_1/002-0122962-7851254?
v=glance&s=books]
---
---
Internet: see also:
---
The TurboPower regular expression page:
http://www.turbopower.com/products/systools/RegularExpressions/
Adding Regular Expression Filename Filtering to ShellListView
http://delphi.about.com/library/weekly/aa052503a.htm
---
Faqts : Computers : Programming : Regular expression
http://www.faqts.com/knowledge_base/index.phtml/fid/1237
---
---
Other free downloadable TurboPower Delphi libraries:
---
http://www.turbopower.com/products/
---
TurboPower Abbrevia
http://sourceforge.net/projects/tpabbrevia/
Abbrevia 3 ZIP/CAB/GIP/TAR compatible data compression with visual
controls and Compressed Compound File support
---
TurboPower Async Professional
http://sourceforge.net/projects/tpapro/
Async Professional
Award-winning serial communications, plus faxing, telephony, and speech
support.
ActiveX Serial communications, VT100 Terminal
emulation, file transfer protocols in an easy to use ActiveX control.
Libraries for use with ActiveX environments such as Microsoft Visual
Basic and Visual C++
---
TurboPower Async Professional CLX
http://sourceforge.net/projects/tpaproclx
Async Professional CLX Full com port control, serial communications,
VT100 terminal emulation, file transfer protocols for Linux.Libraries
for use with Borland Kylix (Delphi for Linux)
---
TurboPower B-Tree Filer
http://sourceforge.net/projects/tpbtreefiler
B-Tree Filer is a fast library of file-based database routines for
Borland Turbo Pascal & Delphi. B-Tree Filer supports stand-alone
programs or those running on Microsoft-compatible networks including
Novell Netware.
---
TurboPower Essentials
http://sourceforge.net/projects/tpessence
Essentials contains 13 native VCL controls for Borland Delphi &
C++Builder. The controls include drop-down calendars & calculators,
roll-up dialogs, 3-D labels, tiled backgrounds, scrolling messages,
menu buttons, and more.
---
TurboPower FlashFiler
http://sourceforge.net/projects/tpflashfiler
client/server, SQL enabled database engine ODBC Access FlashFiler data
from practically anywhere!
---
TurboPower Internet Professional
http://sourceforge.net/projects/tpipro
Winsock communications with Internet components for mail, news, HTML
display, FTP, many more.
---
TurboPower LockBox
http://sourceforge.net/projects/tplockbox
Public & private key encryption, digital signatures, DES and AES.
Supports Delphi and C++Builder.
---
TurboPower Object Professional
http://sourceforge.net/projects/tpopro
Object Professional is a library of over 2000 methods and procedures
for writing sophisticated DOS text mode applications with Turbo Pascal
5.5, 6.0, 7.0, or Borland Pascal 7.
---
TurboPower OfficePartner
http://sourceforge.net/projects/tpofficepartner
OfficePartner is the easy way to integrate your projects with Microsoft
Office, the worlds leading business productivity software. With
OfficePartner you can access COM services in Microsoft Office with easy
to use VCL components.
---
TurboPower OnGuard
http://sourceforge.net/projects/tponguard
OnGuard is a library to create demo versions of your Borland Delphi &
C++Builder applications. Create demo versions that are time-limited,
feature-limited, limited to a certain number of uses, or limited to a
certain # of concurrent network users.
---
TurboPower Orpheus
http://sourceforge.net/projects/tporpheus
Orpheus is an award-winning UI toolkit for Borland Delphi & C++Builder.
It contains over 120 components covering everything from data entry to
calendars and clocks. Other noteworthy components include an Object
Inspector, LookOut bar, & report views.
---
TurboPower ShellShock
http://sourceforge.net/projects/tpshellshock
ShellShock provides a set of components that let you customize
applications with the functionality available in the Windows Shell &
Windows Explorer, all without writing code. The components are written
in native VCL for Borland Delphi & C++Builder.
---
TurboPower String Resource Manager
http://sourceforge.net/projects/tpsrmgr
The TurboPower String Resource Manger is a tool for building string
resource libraries in Borland Delphi. It prevents string resource
clashes and simplifies the translation of the string resources.
---
TurboPower SysTools
http://sourceforge.net/projects/tpsystools/
SysTools is a library of utility routines & classes for Borland Delphi,
C++Builder, & environments that support COM. It includes 1-D & 2-D bar
codes, sorting, money routines, logging, high-precision math, a
run-time math expression analyzer, regular expression analyzer & much
more.
---
TurboPower SysTools for Kylix
http://sourceforge.net/projects/tpsystoolskylix
---
TurboPower Visual PlanIt
http://sourceforge.net/projects/tpvplanit
Visual PlanIt is a set of synchronized, data-aware components for
adding time, task, & contact management capabilities to applications
written in Borland Delphi & C++Builder. Get that Outlook look & feel
without the hassle.
---
---
Internet: see also:
Delphi: Search: Regular expression: Create: How to create a regular
expression parser in Delphi?
http://www.faqts.com/knowledge_base/view.phtml/aid/25645/fid/175
---
http://www.turbopower.com
----------------------------------------------------------------------