tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
14
Task/Regular-expressions/Standard-ML/regular-expressions.ml
Normal file
14
Task/Regular-expressions/Standard-ML/regular-expressions.ml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
CM.make "$/regexp-lib.cm";
|
||||
structure RE = RegExpFn (
|
||||
structure P = AwkSyntax
|
||||
structure E = BackTrackEngine);
|
||||
val re = RE.compileString "string$";
|
||||
val string = "I am a string";
|
||||
case StringCvt.scanString (RE.find re) string
|
||||
of NONE => print "match failed\n"
|
||||
| SOME match =>
|
||||
let
|
||||
val {pos, len} = MatchTree.root match
|
||||
in
|
||||
print ("matched at position " ^ Int.toString pos ^ "\n")
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue