Skip to content

Instantly share code, notes, and snippets.

@djnym
Created March 14, 2011 22:31
Show Gist options
  • Save djnym/870015 to your computer and use it in GitHub Desktop.
Save djnym/870015 to your computer and use it in GitHub Desktop.
Use of proper to test a simple regex
-module (tmp).
-include_lib ("proper/include/proper.hrl").
prop_all () ->
?FORALL (Int, non_neg_integer(),
begin
{match, [O]} =
re:run (integer_to_list(Int), <<"[0-9]+">>,
[{capture,first,list}]),
Int =:= list_to_integer (O)
end).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment