Compilers
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives FAQs Compilers

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old May 11th, 2008, 11:10 PM
Daniel Villeneuve
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Leftmost longest match with DFA search

Stefan Monnier wrote:
Can someone point me to articles that discuss various ways to get the
leftmost longest match when implementing regexp search using a DFA?
>

The "obvious" solution of turning the problem "search for RE" into the
problem "match .*RE" (where I use "match" here to mean "anchored
search") only gives you the leftmost shortest match.
[snip]
Stefan

I've used the approach to compile a DFA for the reverse RE, say ER, and
first match .*ER on the reverse text to find the leftmost anchor point.
Then match RE from that point to find the longest span.
--
Daniel Villeneuve
Kronos


Reply With Quote
  #2  
Old May 14th, 2008, 12:01 PM
Stefan Monnier
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Leftmost longest match with DFA search

>Can someone point me to articles that discuss various ways to get the
>leftmost longest match when implementing regexp search using a DFA?
>>

>The "obvious" solution of turning the problem "search for RE" into the
>problem "match .*RE" (where I use "match" here to mean "anchored
>search") only gives you the leftmost shortest match.

[snip]
>Stefan


I've used the approach to compile a DFA for the reverse RE, say ER, and
first match .*ER on the reverse text to find the leftmost anchor point.
Then match RE from that point to find the longest span.

Interesting. But doesn't it basically force you to scan the complete text?
That can be impractical.


Stefan

Reply With Quote
Reply

Viewing: Web Development Archives FAQs Compilers > Leftmost longest match with DFA search


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway