rx

Functions


t() -> ok

For debugging only.

match(Str, RegExp) -> nomatch | [string()]

  • Str = string() | [string | binary] | binary
  • RegExp = string() | binary

This function tries to match the Posix regular expression RegExp with the contents of Str. It returns a list of matched strings if a match was found and nomatch otherwise. The list of matched strings looks like this: [FullMatch, SubMatch1, SubMatch2, ...] where FullMatch is the string matched by the whole regular expression and SubMatchN is the string that matched subexpression no N. Subexpressions are denoted with '(' ')' in the regular expression

Example:

  match("abc01xyz02rst23", "abc[0-9][0-9]"),
  returns  ["abc01"]
 
  match("abc01xyz02rst23", "([a-z]+[0-9]+)([a-z]+[0-9]+)([a-z]+[0-9]+)"),
  returns ["abc01xyz02rst23","abc01","xyz02","rst23"]
  

match_pos(Str, RegExp) -> nomatch | [{Start, End}]

  • Start = integer()
  • End = integer()

This function is equivalent to match/2, but it returns a list of positions instead for a list of strings.

lmatch(RestLines::Lines, RegExp) -> nomatch | {[string()], Rest}

  • Lines = [Str]
  • Rest = [Str]
  • Str = string() | [string | binary] | binary
  • RegExp = string() | binary

Performs match/2 on each string in Lines. The first match found is returned along with the rest of the Lines. If no match is found, nomatch is returned.

See also: match/2.

View Functions