ajreg.c


Function ajRegComp

Compiles a regular expression.

Synopsis

Prototype
AjPRegexp ajRegComp (
      const AjPStr rexp
);

TypeNameRead/WriteDescription
const AjPStrrexpInputRegular expression string.
AjPRegexp RETURNCompiled regular expression.

Input
rexp:(Input)Regular expression string.
Returns
AjPRegexp:Compiled regular expression.

Description

Compiles a regular expression.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegCompC

Compiles a regular expression.

Synopsis

Prototype
AjPRegexp ajRegCompC (
      const char* rexp
);

TypeNameRead/WriteDescription
const char*rexpInputRegular expression character string.
AjPRegexp RETURNCompiled regular expression.

Input
rexp:(Input)Regular expression character string.
Returns
AjPRegexp:Compiled regular expression.

Description

Compiles a regular expression.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegCompCase

Compiles a case-insensitive regular expression.

Synopsis

Prototype
AjPRegexp ajRegCompCase (
      const AjPStr rexp
);

TypeNameRead/WriteDescription
const AjPStrrexpInputRegular expression string.
AjPRegexp RETURNCompiled regular expression.

Input
rexp:(Input)Regular expression string.
Returns
AjPRegexp:Compiled regular expression.

Description

Compiles a case-insensitive regular expression.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegCompCaseC

Compiles a case-insensitive regular expression.

Synopsis

Prototype
AjPRegexp ajRegCompCaseC (
      const char* rexp
);

TypeNameRead/WriteDescription
const char*rexpInputRegular expression character string.
AjPRegexp RETURNCompiled regular expression.

Input
rexp:(Input)Regular expression character string.
Returns
AjPRegexp:Compiled regular expression.

Description

Compiles a case-insensitive regular expression.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegExec

Execute a regular expression search. The expression must first have been compiled with ajRegComp or ajRegCompC.

Internal data structures in the expression will be set to substrings which other functions can retrieve.

Synopsis

Prototype
AjBool ajRegExec (
      AjPRegexp prog,
      const AjPStr str
);

TypeNameRead/WriteDescription
AjPRegexpprogModifyCompiled regular expression.
const AjPStrstrInputString to be compared.
AjBool RETURNajTrue if a match was found.

Input
str:(Input)String to be compared.
Input & Output
prog:(Modify)Compiled regular expression.
Returns
AjBool:ajTrue if a match was found.

Description

Execute a regular expression search. The expression must first have been compiled with ajRegComp or ajRegCompC.

Internal data structures in the expression will be set to substrings which other functions can retrieve.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegExecC

Execute a regular expression search. The expression must first have been compiled with ajRegComp or ajRegCompC.

Internal data structures in the expression will be set to substrings which other functions can retrieve.

Synopsis

Prototype
AjBool ajRegExecC (
      AjPRegexp prog,
      const char* str
);

TypeNameRead/WriteDescription
AjPRegexpprogModifyCompiled regular expression.
const char*strInputString to be compared.
AjBool RETURNajTrue if a match was found.

Input
str:(Input)String to be compared.
Input & Output
prog:(Modify)Compiled regular expression.
Returns
AjBool:ajTrue if a match was found.

Description

Execute a regular expression search. The expression must first have been compiled with ajRegComp or ajRegCompC.

Internal data structures in the expression will be set to substrings which other functions can retrieve.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegOffset

After a successful regular expression match, uses the regular expression and the original string to calculate the offset of the match from the start of the string.

This information is normally lost during processing.

Synopsis

Prototype
ajint ajRegOffset (
      const AjPRegexp rp
);

TypeNameRead/WriteDescription
const AjPRegexprpInputCompiled regular expression.
ajint RETURNOffset of match from start of string. -1 if the string and the expression do not match.

Input
rp:(Input)Compiled regular expression.
Returns
ajint:Offset of match from start of string. -1 if the string and the expression do not match.

Description

After a successful regular expression match, uses the regular expression and the original string to calculate the offset of the match from the start of the string.

This information is normally lost during processing.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegOffsetI

After a successful regular expression match, uses the regular expression and the original string to calculate the offset of a substring from the start of the string.

This information is normally lost during processing.

Synopsis

Prototype
ajint ajRegOffsetI (
      const AjPRegexp rp,
      ajint isub
);

TypeNameRead/WriteDescription
const AjPRegexprpInputCompiled regular expression.
ajintisubInputSubstring number.
ajint RETURNOffset of match from start of string. -1 if the string and the expression do not match.

Input
rp:(Input)Compiled regular expression.
isub:(Input)Substring number.
Returns
ajint:Offset of match from start of string. -1 if the string and the expression do not match.

Description

After a successful regular expression match, uses the regular expression and the original string to calculate the offset of a substring from the start of the string.

This information is normally lost during processing.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegLenI

After a successful comparison, returns the length of a substring.

Synopsis

Prototype
ajint ajRegLenI (
      const AjPRegexp rp,
      ajint isub
);

TypeNameRead/WriteDescription
const AjPRegexprpInputCompiled regular expression.
ajintisubInputSubstring number.
ajint RETURNSubstring length, or 0 if not found.

Input
rp:(Input)Compiled regular expression.
isub:(Input)Substring number.
Returns
ajint:Substring length, or 0 if not found.

Description

After a successful comparison, returns the length of a substring.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegPost

After a successful match, returns the remainder of the string.

Synopsis

Prototype
AjBool ajRegPost (
      const AjPRegexp rp,
      AjPStr* post
);

TypeNameRead/WriteDescription
const AjPRegexprpInputCompiled regular expression.
AjPStr*postOutputString to hold the result.
AjBool RETURNajTrue on success.

Input
rp:(Input)Compiled regular expression.
Output
post:(Output)String to hold the result.
Returns
AjBool:ajTrue on success.

Description

After a successful match, returns the remainder of the string.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegPostC

After a successful match, returns the remainder of the string. Result is a character string, which is set to point to the internal string data. This in turn is part of the original string. If this changes then the results are undefined.

Synopsis

Prototype
AjBool ajRegPostC (
      const AjPRegexp rp,
      const char** post
);

TypeNameRead/WriteDescription
const AjPRegexprpInputCompiled regular expression.
const char**postOutputCharacter string to hold the result.
AjBool RETURNajTrue on success.

Input
rp:(Input)Compiled regular expression.
Output
post:(Output)Character string to hold the result.
Returns
AjBool:ajTrue on success.

Description

After a successful match, returns the remainder of the string. Result is a character string, which is set to point to the internal string data. This in turn is part of the original string. If this changes then the results are undefined.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegPre

After a successful match, returns the string before the match.

Synopsis

Prototype
AjBool ajRegPre (
      const AjPRegexp rp,
      AjPStr* dest
);

TypeNameRead/WriteDescription
const AjPRegexprpInputCompiled regular expression.
AjPStr*destOutputString to hold the result.
AjBool RETURNajTrue on success.

Input
rp:(Input)Compiled regular expression.
Output
dest:(Output)String to hold the result.
Returns
AjBool:ajTrue on success.

Description

After a successful match, returns the string before the match.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegSubI

After a successful match, returns a substring.

Synopsis

Prototype
AjBool ajRegSubI (
      const AjPRegexp rp,
      ajint isub,
      AjPStr* dest
);

TypeNameRead/WriteDescription
const AjPRegexprpInputCompiled regular expression.
ajintisubInputSubstring number.
AjPStr*destOutputString to hold the result.
AjBool RETURNajTrue if a substring was defined ajFalse if the substring is not matched ajFalse if isub is out of range

Input
rp:(Input)Compiled regular expression.
isub:(Input)Substring number.
Output
dest:(Output)String to hold the result.
Returns
AjBool:ajTrue if a substring was defined ajFalse if the substring is not matched ajFalse if isub is out of range

Description

After a successful match, returns a substring.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegFree

Clears and frees a compiled regular expression.

Synopsis

Prototype
void ajRegFree (
      AjPRegexp* pexp
);

TypeNameRead/WriteDescription
AjPRegexp*pexpDeleteCompiled regular expression.
void RETURN

Output
pexp:(Delete)Compiled regular expression.
Returns
void:No return value

Description

Clears and frees a compiled regular expression.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegTrace

Traces a compiled regular expression with debug calls.

Synopsis

Prototype
void ajRegTrace (
      const AjPRegexp rexp
);

TypeNameRead/WriteDescription
const AjPRegexprexpInputCompiled regular expression.
void RETURN

Input
rexp:(Input)Compiled regular expression.
Returns
void:No return value

Description

Traces a compiled regular expression with debug calls.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajRegExit

Prints a summary of regular expression (AjPRegexp) usage with debug calls

Synopsis

Prototype
void ajRegExit (
      void
);

TypeNameRead/WriteDescription
void RETURN

Returns
void:No return value

Description

Prints a summary of regular expression (AjPRegexp) usage with debug calls

See Also

See other functions in this section

Availability

In release 6.4.0