Module Oniguruma
Bindings to K.Kosako's Oniguruma library. Also see the Oniguruma API documentation.
type _ tA regular expression. The phantom type parameter indicates the encoding, so that regular expressions for different encodings may not be mixed.
module Encoding : sig ... endCharacter encodings.
module Options : sig ... endRegex options.
module Syntax : sig ... endThe syntax type.
module Region : sig ... endMatch results.
val create : string -> Options.compile_time Options.t -> 'enc Encoding.t -> Syntax.t -> ('enc t, string) Stdlib.resultcreate pattern options encoding syntaxcreates a regex.
val search : 'enc t -> string -> int -> int -> Options.search_time Options.t -> Region.t optionsearch regex string start range optionsearchesString.sub string start rangeforregex. RaisesErrorif there is an error (other than a mismatch).- parameter regex
The pattern to search for
- parameter string
The string to search
- parameter start
The string position to start searching from, as a byte offset
- parameter range
The string position to stop searching at, as a byte offset
- parameter option
Search options
val match_ : 'enc t -> string -> int -> Options.search_time Options.t -> Region.t optionmatch_ regex string pos optionsmatchesregexagainststringat positionpos. RaisesErrorif there is an error (other than a mismatch).- parameter regex
The pattern to match
- parameter string
The string to match against
- parameter pos
The position of the string to match at, as a byte offset
- parameter options
Match options
val num_captures : _ t -> intThe number of capture groups in the regex. The entire match itself does not count as a capture group.