home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,443 of 2,753   
   Ben Hanson to All   
   Re: Regular expression string searching    
   11 Mar 18 13:52:53   
   
   From: jamin.hanson@googlemail.com   
      
   > /This/ actually worked for me (one character change):   
   >   
   > [/][*]([^*]|[*]+[^/])*[*]+[/]   
      
   Your modified regex produces the following state machine:   
      
   State: 0   
     [/] -> 1   
      
   State: 1   
     [*] -> 2   
      
   State: 2   
     [^*] -> 2   
     [*] -> 3   
      
   State: 3   
     [^*/] -> 2   
     [*] -> 4   
     [/] -> 5   
      
   State: 4   
     [^*/] -> 2   
     [*] -> 4   
     [/] -> 6   
      
   State: 5   
     END STATE   
      
   State: 6   
     END STATE   
     [^*] -> 2   
     [*] -> 3   
      
   Which will match   
      
   /***/a*/   
      
   in its entirety, when if should only match   
      
   /***/   
      
   Regards,   
      
   Ben   
   [Doesn't that depend on whether you interpret the END STATE in state 6 to stop   
   even   
   if there's more input? -John]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca