*** regexp.erl.orig	Thu Mar 27 23:52:27 2003
--- regexp.erl	Fri Mar 28 00:00:47 2003
***************
*** 25,31 ****
  %% that. This method seems to go significantly faster.
  
  -export([sh_to_awk/1,parse/1,format_error/1,match/2,first_match/2,matches/2]).
! -export([sub/3,gsub/3,split/2]).
  
  -import(string, [substr/2,substr/3]).
  -import(lists, [reverse/1]).
--- 25,31 ----
  %% that. This method seems to go significantly faster.
  
  -export([sh_to_awk/1,parse/1,format_error/1,match/2,first_match/2,matches/2]).
! -export([sub/3,gsub/3,split/2,is_match/2]).
  
  -import(string, [substr/2,substr/3]).
  -import(lists, [reverse/1]).
***************
*** 378,383 ****
--- 378,399 ----
  	{St1,0} -> [{St1,0}|matches(substr(S, St1+2-St), RE, St1+1)];
  	{St1,L1} -> [{St1,L1}|matches(substr(S, St1+L1+1-St), RE, St1+L1)];
  	nomatch -> []
+     end.
+ 
+ %% -type is_match(String, RegExp) -> true | false | {error,E}.
+ %%  Return a boolean indicating whether or not the RegExp matches String.
+ %%  This is because there doesn't appear to be any other way to determine
+ %%  if a RegExp (e.g. "^.*$") matches a null string (no chars to return!)
+ 
+ is_match(String, RegExp) when list(RegExp) ->
+     case parse(RegExp) of
+         {ok,RE} -> is_match(String, RE);
+         {error,E} -> {error,E}
+     end;
+ is_match(String, RegExp) ->
+     case re_apply(String, 1, RegExp) of
+         {match,_,_} -> true;
+         nomatch -> false
      end.
  
  %% -type sub(String, RegExp, Replace) -> subsres().
