com.caucho.quercus.lib.regexp
Class RegexpModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.regexp.RegexpModule
All Implemented Interfaces:
QuercusModule

public class RegexpModule
extends AbstractQuercusModule


Field Summary
static int PCRE_UTF8
           
static java.lang.String PCRE_VERSION
           
static int PREG_BACKTRACK_LIMIT_ERROR
           
static int PREG_BAD_UTF8_ERROR
           
static int PREG_BAD_UTF8_OFFSET_ERROR
           
static int PREG_GREP_INVERT
           
static int PREG_INTERNAL_ERROR
           
static int PREG_NO_ERROR
           
static int PREG_OFFSET_CAPTURE
           
static int PREG_PATTERN_ORDER
           
static boolean[] PREG_QUOTE
           
static int PREG_RECURSION_LIMIT_ERROR
           
static int PREG_REPLACE_EVAL
           
static int PREG_SET_ORDER
           
static int PREG_SPLIT_DELIM_CAPTURE
           
static int PREG_SPLIT_NO_EMPTY
           
static int PREG_SPLIT_OFFSET_CAPTURE
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
RegexpModule()
           
 
Method Summary
static Regexp compileRegexp(StringValue regexpValue)
           
static Ereg createEreg(Env env, Value value)
           
static Ereg createEreg(Value value)
           
static Eregi createEregi(Env env, Value value)
           
static Eregi createEregi(Value value)
           
static Regexp createRegexp(Env env, StringValue regexpValue)
           
static Regexp createRegexp(StringValue regexpValue)
           
static Regexp[] createRegexpArray(Env env, Value pattern)
           
static Regexp[] createRegexpArray(Value pattern)
           
static UnicodeEreg createUnicodeEreg(Env env, StringValue pattern)
           
static UnicodeEreg createUnicodeEreg(Env env, StringValue pattern, java.lang.String encoding)
           
static UnicodeEregi createUnicodeEregi(Env env, StringValue pattern)
           
static UnicodeEregi createUnicodeEregi(Env env, StringValue pattern, java.lang.String encoding)
           
static Value ereg_replace(Env env, Value regexpValue, Value replacement, StringValue subject)
          Replaces values using regexps
static Value ereg(Env env, Ereg regexp, StringValue string, Value regsV)
          Returns the index of the first match.
static Value eregi_replace(Env env, Value regexpValue, Value replacement, StringValue subject)
          Replaces values using regexps
static Value eregi(Env env, Eregi regexp, StringValue string, Value regsV)
          Returns the index of the first match.
static Value eregImpl(Env env, Ereg regexp, StringValue string, Value regsV)
          Returns the index of the first match.
static Value eregReplaceImpl(Env env, Ereg regexp, Value replacement, StringValue subject, boolean isCaseInsensitive)
          Replaces values using regexps
 java.lang.String[] getLoadedExtensions()
          Returns the extensions loaded by the module.
static int getRegexpCacheSize()
           
static Value preg_grep(Env env, Regexp regexp, ArrayValue input, int flag)
          Returns an array of all the values that matched the given pattern if the flag no flag is passed.
static Value preg_last_error(Env env)
          Returns the last regexp error
static Value preg_match_all(Env env, Regexp regexp, StringValue subject, Value matchRef, int flags, int offset)
          Returns the number of full pattern matches or FALSE on error.
static Value preg_match(Env env, Regexp regexp, StringValue subject, Value matchRef, int flags, int offset)
           
static StringValue preg_quote(StringValue string, StringValue delim)
          Quotes regexp values
static Value preg_replace_callback(Env env, Regexp regexp, Callable fun, Value subject, long limit, Value count)
          Loops through subject if subject is array of strings
static Value preg_replace_callback(Env env, Value regexpValue, Callable fun, Value subject, long limit, Value count)
          Loops through subject if subject is array of strings
static Value preg_replace(Env env, Regexp regexp, Value replacement, Value subject, long limit, Value count)
          Loops through subject if subject is array of strings
static Value preg_replace(Env env, Value pattern, Value replacement, Value subject, long limit, Value count)
          Loops through subject if subject is array of strings
static Value preg_split(Env env, Regexp regexp, StringValue string, long limit, int flags)
          Returns array of substrings or of arrays ([0] => substring [1] => offset) if PREG_SPLIT_OFFSET_CAPTURE is set
static LongValue pregMatchAllPatternOrder(Env env, RegexpState regexpState, StringValue subject, ArrayValue matches, int flags, int offset)
          Returns the index of the first match.
static void setRegexpCacheSize(int size)
           
static Value split(Env env, Ereg regexp, StringValue string, long limit)
          Returns an array of strings produces from splitting the passed string around the provided pattern.
static Value spliti(Env env, Eregi regexp, StringValue string, long limit)
          Returns an array of strings produces from splitting the passed string around the provided pattern.
static StringValue sql_regcase(StringValue string)
          Makes a regexp for a case-insensitive match.
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap, getIniDefinitions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREG_REPLACE_EVAL

public static final int PREG_REPLACE_EVAL
See Also:
Constant Field Values

PCRE_UTF8

public static final int PCRE_UTF8
See Also:
Constant Field Values

PREG_PATTERN_ORDER

public static final int PREG_PATTERN_ORDER
See Also:
Constant Field Values

PREG_SET_ORDER

public static final int PREG_SET_ORDER
See Also:
Constant Field Values

PREG_OFFSET_CAPTURE

public static final int PREG_OFFSET_CAPTURE
See Also:
Constant Field Values

PREG_SPLIT_NO_EMPTY

public static final int PREG_SPLIT_NO_EMPTY
See Also:
Constant Field Values

PREG_SPLIT_DELIM_CAPTURE

public static final int PREG_SPLIT_DELIM_CAPTURE
See Also:
Constant Field Values

PREG_SPLIT_OFFSET_CAPTURE

public static final int PREG_SPLIT_OFFSET_CAPTURE
See Also:
Constant Field Values

PREG_GREP_INVERT

public static final int PREG_GREP_INVERT
See Also:
Constant Field Values

PREG_NO_ERROR

public static final int PREG_NO_ERROR
See Also:
Constant Field Values

PREG_INTERNAL_ERROR

public static final int PREG_INTERNAL_ERROR
See Also:
Constant Field Values

PREG_BACKTRACK_LIMIT_ERROR

public static final int PREG_BACKTRACK_LIMIT_ERROR
See Also:
Constant Field Values

PREG_RECURSION_LIMIT_ERROR

public static final int PREG_RECURSION_LIMIT_ERROR
See Also:
Constant Field Values

PREG_BAD_UTF8_ERROR

public static final int PREG_BAD_UTF8_ERROR
See Also:
Constant Field Values

PREG_BAD_UTF8_OFFSET_ERROR

public static final int PREG_BAD_UTF8_OFFSET_ERROR
See Also:
Constant Field Values

PCRE_VERSION

public static final java.lang.String PCRE_VERSION
See Also:
Constant Field Values

PREG_QUOTE

public static final boolean[] PREG_QUOTE
Constructor Detail

RegexpModule

public RegexpModule()
Method Detail

getLoadedExtensions

public java.lang.String[] getLoadedExtensions()
Description copied from class: AbstractQuercusModule
Returns the extensions loaded by the module.

Specified by:
getLoadedExtensions in interface QuercusModule
Overrides:
getLoadedExtensions in class AbstractQuercusModule

getRegexpCacheSize

public static int getRegexpCacheSize()

setRegexpCacheSize

public static void setRegexpCacheSize(int size)

ereg

public static Value ereg(Env env,
                         Ereg regexp,
                         StringValue string,
                         Value regsV)
Returns the index of the first match.

Parameters:
env - the calling environment

eregi

public static Value eregi(Env env,
                          Eregi regexp,
                          StringValue string,
                          Value regsV)
Returns the index of the first match.

Parameters:
env - the calling environment

eregImpl

public static Value eregImpl(Env env,
                             Ereg regexp,
                             StringValue string,
                             Value regsV)
Returns the index of the first match.

Parameters:
env - the calling environment

compileRegexp

public static Regexp compileRegexp(StringValue regexpValue)

createRegexp

public static Regexp createRegexp(StringValue regexpValue)

createRegexp

public static Regexp createRegexp(Env env,
                                  StringValue regexpValue)

createRegexpArray

public static Regexp[] createRegexpArray(Value pattern)

createRegexpArray

public static Regexp[] createRegexpArray(Env env,
                                         Value pattern)

createEreg

public static Ereg createEreg(Env env,
                              Value value)

createEreg

public static Ereg createEreg(Value value)

createEregi

public static Eregi createEregi(Env env,
                                Value value)

createEregi

public static Eregi createEregi(Value value)

createUnicodeEreg

public static UnicodeEreg createUnicodeEreg(Env env,
                                            StringValue pattern)

createUnicodeEreg

public static UnicodeEreg createUnicodeEreg(Env env,
                                            StringValue pattern,
                                            java.lang.String encoding)

createUnicodeEregi

public static UnicodeEregi createUnicodeEregi(Env env,
                                              StringValue pattern)

createUnicodeEregi

public static UnicodeEregi createUnicodeEregi(Env env,
                                              StringValue pattern,
                                              java.lang.String encoding)

preg_last_error

public static Value preg_last_error(Env env)
Returns the last regexp error


preg_match

public static Value preg_match(Env env,
                               Regexp regexp,
                               StringValue subject,
                               Value matchRef,
                               int flags,
                               int offset)

preg_match_all

public static Value preg_match_all(Env env,
                                   Regexp regexp,
                                   StringValue subject,
                                   Value matchRef,
                                   int flags,
                                   int offset)
Returns the number of full pattern matches or FALSE on error.

Parameters:
env - the calling environment

pregMatchAllPatternOrder

public static LongValue pregMatchAllPatternOrder(Env env,
                                                 RegexpState regexpState,
                                                 StringValue subject,
                                                 ArrayValue matches,
                                                 int flags,
                                                 int offset)
Returns the index of the first match.

Parameters:
env - the calling environment

preg_quote

public static StringValue preg_quote(StringValue string,
                                     StringValue delim)
Quotes regexp values


preg_replace

public static Value preg_replace(Env env,
                                 Regexp regexp,
                                 Value replacement,
                                 Value subject,
                                 long limit,
                                 Value count)
Loops through subject if subject is array of strings

Parameters:
env -
pattern - string or array
replacement - string or array
subject - string or array
limit -
count -
Returns:

preg_replace

public static Value preg_replace(Env env,
                                 Value pattern,
                                 Value replacement,
                                 Value subject,
                                 long limit,
                                 Value count)
Loops through subject if subject is array of strings

Parameters:
env -
pattern - string or array
replacement - string or array
subject - string or array
limit -
count -
Returns:

ereg_replace

public static Value ereg_replace(Env env,
                                 Value regexpValue,
                                 Value replacement,
                                 StringValue subject)
Replaces values using regexps


eregi_replace

public static Value eregi_replace(Env env,
                                  Value regexpValue,
                                  Value replacement,
                                  StringValue subject)
Replaces values using regexps


eregReplaceImpl

public static Value eregReplaceImpl(Env env,
                                    Ereg regexp,
                                    Value replacement,
                                    StringValue subject,
                                    boolean isCaseInsensitive)
Replaces values using regexps


preg_replace_callback

public static Value preg_replace_callback(Env env,
                                          Regexp regexp,
                                          Callable fun,
                                          Value subject,
                                          long limit,
                                          Value count)
Loops through subject if subject is array of strings

Parameters:
env -
pattern -
fun -
subject -
limit -
count -
Returns:

preg_replace_callback

public static Value preg_replace_callback(Env env,
                                          Value regexpValue,
                                          Callable fun,
                                          Value subject,
                                          long limit,
                                          Value count)
Loops through subject if subject is array of strings


preg_split

public static Value preg_split(Env env,
                               Regexp regexp,
                               StringValue string,
                               long limit,
                               int flags)
Returns array of substrings or of arrays ([0] => substring [1] => offset) if PREG_SPLIT_OFFSET_CAPTURE is set

Parameters:
env - the calling environment

sql_regcase

public static StringValue sql_regcase(StringValue string)
Makes a regexp for a case-insensitive match.


split

public static Value split(Env env,
                          Ereg regexp,
                          StringValue string,
                          long limit)
Returns an array of strings produces from splitting the passed string around the provided pattern. The pattern is case sensitive.

Parameters:
patternString - the pattern
string - the string to split
limit - if specified, the maximum number of elements in the array
Returns:
an array of strings split around the pattern string

spliti

public static Value spliti(Env env,
                           Eregi regexp,
                           StringValue string,
                           long limit)
Returns an array of strings produces from splitting the passed string around the provided pattern. The pattern is case insensitive.

Parameters:
patternString - the pattern
string - the string to split
limit - if specified, the maximum number of elements in the array
Returns:
an array of strings split around the pattern string

preg_grep

public static Value preg_grep(Env env,
                              Regexp regexp,
                              ArrayValue input,
                              int flag)
Returns an array of all the values that matched the given pattern if the flag no flag is passed. Otherwise it will return an array of all the values that did not match.

Parameters:
patternString - the pattern
input - the array to check the pattern against
flag - 0 for matching and 1 for elements that do not match
Returns:
an array of either matching elements are non-matching elements