Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 7th, 2005, 9:03 AM   #1
SittingDuck
Programmer
 
SittingDuck's Avatar
 
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 4 SittingDuck is on a distinguished road
Perl-type Regular Expression Implementation

How do I implement Perl-type regular expressions? I thought that I could take it element by element and compare it, but I don't know where to start.
SittingDuck is offline   Reply With Quote
Old Dec 7th, 2005, 9:05 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
What do you mean, "implement it"? Use it? Write your own?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Dec 7th, 2005, 9:13 AM   #3
SittingDuck
Programmer
 
SittingDuck's Avatar
 
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 4 SittingDuck is on a distinguished road
Write my own handler.
SittingDuck is offline   Reply With Quote
Old Dec 7th, 2005, 10:30 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
...I don't know where to start.
With a lot of research. Really, really difficult isn't exactly the same thing as really, really complex, but there's a strong correlation. Once you've written the thing, you'll understand why knowledgeable programmers use substring functions instead of regex wherever possible.

Begin by learning to search a haystack string for a needle string (of any length). Then add wild-card capability. Then learn the difference between greedy and non-greedy matching. By the time you get there, you'll have a much clearer picture. By all means, invest your time in concepts quite steeply before you resort to more than minor, experimental code.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Dec 7th, 2005, 12:30 PM   #5
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
There are regex or regexp libraries available. You will have to use those unless you want a really major undertaking.

A VERY SIMPLE, almost useless, version of regexp is the implementation of the scanset in the scanf functions in C.
jim mcnamara is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:07 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC