![]() |
sponsored links |
|
|
sponsored links
|
|
1
27th February 05:39
External User
Posts: 1
|
Many thanks to you all for your replies.
Marco van der Voort,'s freepascal reference looks interesting but daunting, but I'll have a closer look at it. My command of C / C++ is dodgy and insufficient to translate C code to Pascal. I certainly agree with John Stockton's opinion that regexps should be a standard language feature of (well, all) languages. I do use Delphi rather than TP or BP these days, I only have Delphi 2 though which doesn't have a bundled RegExp add-on. Is it available elsewhere?, if so, I shall be grateful for a reference. My current interest in Regexp is for a database query algorithm I am trying to develop. I am looking specifically for two functions like these:- Function eregi(regexpstr: String, TargetStr:String): boolean; begin {returns true if TargetStr contains regexprStr} end; Function eregiReplace(regexpstr: String; ReplaceStr:String;Oldstr:String): String; begin {returns a string where all matches of regexpstr in OldStr with ReplaceStr} end; (An example of regexprStr is:- regexprStr:= '^[a-zA-Z]+$; (* matches any string with 1 or more letters and nothing else*) ) Some months ago, I got into the world of web server-side scripting - CGI and all that good stuff. I find traditional CGI programming difficult to grasp, but the job is made much easier nowadays by PHP {http://www.php.net/}, a powerful scripting language with just about all the features a programmer wants - including Regexp, which implements the two functions above. Unfortunately its impossible to snatch the functions out of the PHP environment. A couple of years ago, I came across Albert Graef's Tply - a Turbo Pascal implementation of the Unix Lex and Yacc compiler makers tools. (See http://www.musikwissenschaft.uni-mainz.de/~ag/tply/). The TPly TPlex tool does have Regexpr Pascal code, but I've not found it possible to dig out the bits needed to implement functions like those above. -- Michael Glover - michael_glover@lineone.netxx (Surrey, UK. http://www.users.globalnet.co.xx/~glover/ ) (Please change "xx" to "uk" to reply/access web site) |
|
|
|