title: Regular Expressions in Prolog
body: <p>To learn a little about regular expressions in Prolog, I'm trying to write functions that determine whether the input fits the pattern; my functions are as follows:</p>
  
  <pre><code>split(W, [[], W]).
  
  split([X|W], [[X|W1], W2]) :- split(W, [W1, W2]).
  
  match(eps, []).
  match(symb(A), [ A ]).
  match(union(R1, R2), W) :- match(R1, W).
  match(union(R1, R2), W) :- match(R2, W).
  match(conc(R1, R2), W)  :- split(W, [W1, W2]), W1 \= [], W2 \= [], match(R1, W1), match(R2, W2).
  match(star(R), W)       :- match(R, eps).
  match(star(R), W)       :- split(W, [W1, W2]), W1 \= [], match(R, W1), match(star(R), W2).
  </code></pre>
  
  <p>I enter into SWIPL the following and get the following results:</p>
  
  <pre><code>?- match(star(symb(a)),[a,a,a,a]).
  false.
  
  ?- match(star(symb(b)),[b]).
  false.
  </code></pre>
  
  <p>As far as I can tell, the other functions are working correctly. Can somebody tell me where I went wrong with handling star?</p>
  
  <p>Thank you!</p>