core :: NativeRegex
It is recommanded to use the higher level API offered by the class Regex
,
but it can still be used for advanced purpose or in optimized code.
To use this class and other private
entities of this module, use intrude import core::re
core :: NativeRegex :: defaultinit
core :: NativeRegex :: malloc
Allocate a newNativeRegex
, it must then be compiled using regcomp
before calling regexec
core :: NativeRegex :: re_nsub
Number of parenthetical subexpressions in this compiled regular expressioncore :: NativeRegex :: regexec
Matchstring
against the precompiled pattern buffer of self
, locating matches
core :: NativeRegex :: regexec_match_only
Matchstring
against the precompiled pattern buffer of self
, do not locate matches
core :: NativeRegex :: regfree
Free the memory allocated to the pattern buffer by the compiling processcore $ NativeRegex :: SELF
Type of this instance, automatically specialized in every classcore :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: NativeRegex :: defaultinit
core :: Object :: defaultinit
core :: Pointer :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: NativeRegex :: malloc
Allocate a newNativeRegex
, it must then be compiled using regcomp
before calling regexec
core :: Object :: native_class_name
The class name of the object in CString format.core :: Pointer :: native_equals
core :: Object :: output_class_name
Display class name on stdout (debug only).core :: Pointer :: premultiply_alpha
Multiply RGB values by their alpha valuecore :: NativeRegex :: re_nsub
Number of parenthetical subexpressions in this compiled regular expressioncore :: NativeRegex :: regexec
Matchstring
against the precompiled pattern buffer of self
, locating matches
core :: NativeRegex :: regexec_match_only
Matchstring
against the precompiled pattern buffer of self
, do not locate matches
core :: NativeRegex :: regfree
Free the memory allocated to the pattern buffer by the compiling process
# Main extern class to wrap libc regular expression support
#
# It is recommanded to use the higher level API offered by the class `Regex`,
# but it can still be used for advanced purpose or in optimized code.
#
# To use this class and other `private` entities of this module, use `intrude import core::re`
private extern class NativeRegex `{ regex_t* `}
# Allocate a new `NativeRegex`, it must then be compiled using `regcomp` before calling `regexec`
new malloc `{ return malloc(sizeof(regex_t)); `}
# Compile the regular expression `regex` into a form that is suitable for subsequent `regexec` searches
fun regcomp(regex: CString, cflags: Int): Int `{
return regcomp(self, regex, cflags);
`}
# Match `string` against the precompiled pattern buffer of `self`, locating matches
#
# `nmatch` and `pmatch` are used to provide information regarding the location of any matches.
# `eflags` may be the bitwise-or of one or both of `flag_notbol` and `flag_noteol`.
fun regexec(string: CString, nmatch: Int, pmatch: NativeMatchArray, eflags: Int): Int `{
return regexec(self, string, nmatch, pmatch, eflags);
`}
# Match `string` against the precompiled pattern buffer of `self`, do not locate matches
#
# `eflags` may be the bitwise-or of one or both of `flag_notbol` and `flag_noteol`.
fun regexec_match_only(string: CString, eflags: Int): Int `{
return regexec(self, string, 0, NULL, eflags);
`}
# Free the memory allocated to the pattern buffer by the compiling process
#
# Does not free the memory holding `self`, use `free` for this purpose.
fun regfree `{ regfree(self); `}
# Turn the error codes that can be returned by both `regcomp` and `regexec` into error message strings
fun regerror(errcode: Int): CString `{
size_t len = regerror(errcode, self, NULL, 0);
char *message = malloc(len);
regerror(errcode, self, message, len);
return message;
`}
# Number of parenthetical subexpressions in this compiled regular expression
fun re_nsub: Int `{ return self->re_nsub; `}
end
lib/core/re.nit:34,1--80,3