Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Pike Module Reference:

module version 1, prepared

  MODULE Public
Modules
Regexp

  MODULE Public.Regexp
Modules
PCRE

  MODULE Public.Regexp.PCRE
Classes
Plain

  CLASS Public.Regexp.PCRE.Plain
Methods
create()
match()
matchall()
replace()
split()

Method create

void Public.Regexp.PCRE.Plain()->create(string pattern, int|void options)

Description

Creates a regex object.

Parameter pattern

The pattern to be used for matching.

Parameter options

Any of the following options ORed together.

Case insensitive matching

The ^ and $ special characters match based on \n characters within the string

The . special character will match anything, including \n

Allow comments using # and ignore unescaped whitespace within the pattern

Force the pattern to only match at the first matching point in the string

The $ special character will not match a final \n at the end of the string

Throw an error when the pattern contains a backslash followed by a letter which has no special meaning

Invert the greediness of matching.

Treat the pattern and subject strings as UTF8 strings. Will throw an error if used when pcre was not compiled with utf8 support

Disable automatic substring capturing. Named substrings may still be used.


Method match

int(0..1) Public.Regexp.PCRE.Plain()->match(string subject, int|void offset)

Description

Returns 1 if subject matches the pattern, or 0 if it does not.

Parameter subject

The string to search.

Parameter offset

The offset into the subject to begin searching.


Method matchall

int|array(int|array(array(string))) Public.Regexp.PCRE.Plain()->matchall(string subject, int|void offset, int|void limit, int|void substrings)

Description

Returns the number of times the pattern matches subject, or an array with the first element the number of matches, and the second element an array of the matched substrings if substrings is not 0.

Parameter subject

The string to search.

Parameter offset

The offset into the subject to begin searching.

Parameter limit

Stop searching for more matches once this many matches have been found.

Parameter substrings

In addition to the number of matches, also return an array containing the matches that were found. Each element in this array is another array, where element 0 is the entire match, and each element after that is a captured substring.


Method replace

string|array(string|array(array(string))) Public.Regexp.PCRE.Plain()->replace(string subject, string|function(array(string) : string) replacement, int|void offset, int|void limit, int|void substrings)

Description

Returns the subject with any matches replaced, or an array with the first element the replaced subject, and the second element an array of the matched substrings if substrings is not 0.

Parameter subject

The string to search and replace in.

Parameter replacement

If replacement is a string, each match in subject will be replaced with this string. If replacement is a function, it will be called for each match, and the matching part of subject will be replaced with the string returned. This function is passed an array of strings, where element 0 is the entire match, and each element after that is a captured substring.

Parameter offset

The offset into the subject to begin searching.

Parameter limit

Stop searching for more matches once this many replacments have been done.

Parameter substrings

In addition to the replaced subject, also return an array containing the matches that were found. Each element in this array is another array, where element 0 is the entire match, and each element after that is a captured substring.


Method split

array(string)|array(array(string)|array(array(string))) Public.Regexp.PCRE.Plain()->split(string subject, int|void offset, int|void limit, int|void substrings)

Description

Returns an array of strings containing the parts of the subject split on the pattern, or an array with the first element the array of the split subject, and the second element an array of the matched substrings if substrings is not 0.

Parameter subject

The string to split.

Parameter offset

The offset into the subject to begin searching.

Parameter limit

Stop searching for more matches to split on once this many matches have been found.

Parameter substrings

In addition to the split subject, also return an array containing the matches that were found. Each element in this array is another array, where element 0 is the entire match, and each element after that is a captured substring.

gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University