Pattern-matching regular-expression algorithm? 
Author Message
 Pattern-matching regular-expression algorithm?

Somewhat off-topic, but since the rest of the program is already written
in fortran, this algorithm (if I can find it) will be, too!

When I retired, I converted all of my personal programs from my university's
UNIX system to DOS, and, over the years, have added some of the more-missed
unix functions (when I couldn't find them already written) as I felt their
loss.  This question comes from another such situation.

I have any number of "grep" programs which can process regular expressions,
but I'd like to do that in MY program, and it's a real pain to create an
intermediate file, shell out to a grep program which produces another
intermediate file, and then finish the job.  I'm processing DOS 8+3 file-
names, and it's easy enough to match *.X and Y.* (where * represents an
number of characters, X represents any three, and Y represents any eight),
and it's not much more difficult to include . (? in DOS) which matches any
one character.  But matching something more general (such as "a.*b") looks
like a LOT of work.

Am I missing something that makes it easier than it looks?
Is there a published algorithm I can incorporate into my program?

--Myron.
--
Five boxes preserve our freedoms:  soap, ballot, witness, jury, and cartridge
PhD EE (retired).   "Barbershop" tenor.   CDL(PTX).   W0PBV.   (785) 539-4448
NRA Life Member and Certified Instructor (Home Firearm Safety, Rifle, Pistol)



Sun, 04 Dec 2005 23:50:51 GMT  
 Pattern-matching regular-expression algorithm?
Hello,

IIRC, NAG have a regexp module on their web site.
http://www.nag.co.uk + somewhere.

--
Cheers!

Dan Nagle
Purple Sage Computing Solutions, Inc.


Quote:
>Somewhat off-topic, but since the rest of the program is already written
>in FORTRAN, this algorithm (if I can find it) will be, too!

>When I retired, I converted all of my personal programs from my university's
>UNIX system to DOS, and, over the years, have added some of the more-missed
>unix functions (when I couldn't find them already written) as I felt their
>loss.  This question comes from another such situation.

>I have any number of "grep" programs which can process regular expressions,
>but I'd like to do that in MY program, and it's a real pain to create an
>intermediate file, shell out to a grep program which produces another
>intermediate file, and then finish the job.  I'm processing DOS 8+3 file-
>names, and it's easy enough to match *.X and Y.* (where * represents an
>number of characters, X represents any three, and Y represents any eight),
>and it's not much more difficult to include . (? in DOS) which matches any
>one character.  But matching something more general (such as "a.*b") looks
>like a LOT of work.

>Am I missing something that makes it easier than it looks?
>Is there a published algorithm I can incorporate into my program?

>--Myron.



Mon, 05 Dec 2005 01:20:31 GMT  
 Pattern-matching regular-expression algorithm?

Quote:

> Hello,

> IIRC, NAG have a regexp module on their web site.
> http://www.nag.co.uk + somewhere.

You might try and interface with a publically available
C library, such as the one by Henry Spencer,
<ftp://ftp.zoo.toronto.edu/pub/regex.shar>,
for instance.

Regards,

Arjen



Mon, 05 Dec 2005 14:33:44 GMT  
 Pattern-matching regular-expression algorithm?

Quote:

>one character.  But matching something more general (such as "a.*b") looks
>like a LOT of work.

>Am I missing something that makes it easier than it looks?
>Is there a published algorithm I can incorporate into my program?

Some time ago I wrote a function called match_wild which handles ? to match
single characters, and * to match zero or more of them.  It's not too long
and may do what you want.  I've put a link to it right at the bottom of
this page: http://www.star.le.ac.uk/~cgp/fortran.html

Let me know if do use it and find any bugs or limitations.

--
Clive Page   cgp <at sign> le.ac.uk



Mon, 05 Dec 2005 16:26:19 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. iss-matching - the free Regular Expression / Pattern Matching cluster

2. Regular Expression for Match Pattern (string) Function

3. Bug in regular expression pattern matching?

4. Regular expression string pattern matching: Embedding pop-11 procedures, and more

5. Regular Expression Pattern Matching "State" Object

6. Regular expressions, pattern matching

7. pattern matching using regular expressions

8. regular expression matching in J ? (or APL)

9. Regular Expression to match HTML elements

10. regular expression: matching ( )

11. Regular expression matching with Halstenbach's REGEXP

12. Binding style and the universality of REs (was: Regular Expression Matching)

 

 
Powered by phpBB® Forum Software