Advertisement
jargon

Windows Explorer style pattern matching attempt

Feb 10th, 2022
3,597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. How do I have my project appropriately perform Windows Explorer style pattern matching? ( This is all I have for now, and it isn't proving to be very fruitful. )
  2.  
  3. ```
  4. function postive_id(pattern as string, subject as string ) as string
  5.    
  6.     dim as string match = string$( 0, 0 ), test = string$( 0, 0 )
  7.     dim as integer pattern_offset = 0, match_offset = 0, test_offset = 0
  8.    
  9.     do while len( test_offset ) > 0
  10.        
  11.         test_offset += 1
  12.         pattern_offset += 1
  13.        
  14.         flag =  mid$( pattern, pattern_offset, 1 )
  15.        
  16.         select case flag
  17.         case "?"
  18.             test += mid$( subject, offset, 1 )
  19.             pattern = mid$( pattern, 2 )
  20.        
  21.         case "*"
  22.             match
  23.             if left$( test, 1 ) = left$( match, 1 ) then
  24.            
  25.             end if
  26.             test += mid$( subject, offset, 1 )
  27.             if test =
  28.             pattern = mid$( pattern, 2 )
  29.    
  30.             pattern_offset += 1
  31.        
  32.         end select
  33.     loop
  34.  
  35. end function
  36. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement