Package org.jruby
Class RubyRegexp
java.lang.Object
org.jruby.RubyBasicObject
org.jruby.RubyObject
org.jruby.RubyRegexp
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<IRubyObject>
,ReOptions
,InstanceVariables
,InternalVariables
,IRubyObject
,EncodingCapable
,MarshalEncoding
,CoreObjectType
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jruby.RubyObject
RubyObject.Data
Nested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
Fields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATOR
Fields inherited from class org.jruby.RubyBasicObject
ALL_F, BASICOBJECT_ALLOCATOR, COMPARE_BY_IDENTITY_F, ERR_INSECURE_SET_INST_VAR, FALSE_F, FL_USHIFT, flags, FROZEN_F, IS_OVERLAID_F, metaClass, NEVER, NIL_F, REFINED_MODULE_F, STAMP_OFFSET, TAINTED_F, UNDEF, USER0_F, USER1_F, USER2_F, USER3_F, USER4_F, USER5_F, USER6_F, USER7_F, USER8_F, USER9_F, USERA_F, VAR_TABLE_OFFSET, varTable, varTableStamp
Fields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAY
Fields inherited from interface org.jruby.parser.ReOptions
RE_DEFAULT, RE_FIXED, RE_LITERAL, RE_MAY_IGNORECASE, RE_NONE, RE_OPTION_EXTENDED, RE_OPTION_IGNORECASE, RE_OPTION_LONGEST, RE_OPTION_MULTILINE, RE_OPTION_NONE, RE_OPTION_ONCE, RE_OPTION_POSIXLINE, RE_OPTION_SINGLELINE, RE_UNICODE
-
Constructor Summary
ConstructorsConstructorDescriptionRubyRegexp
(Ruby runtime, org.joni.Regex pattern, ByteList str, RegexpOptions options) -
Method Summary
Modifier and TypeMethodDescriptioncasefold_p
(ThreadContext context) void
void
static RubyClass
createRegexpClass
(ThreadContext context, RubyClass Object) encoding
(ThreadContext context) eqq
(ThreadContext context, IRubyObject arg) rb_reg_eqqfixed_encoding_p
(ThreadContext context) static IRubyObject
getBackRef
(ThreadContext context) Deprecated.org.jcodings.Encoding
getKCode()
org.jcodings.Encoding
String[]
getNames()
returns all names in a regexp pattern as id (8859_1) stringsThis is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.final RegexpOptions
Deprecated.final RegexpOptions
getOptions
(ThreadContext context) rb_reg_optionsfinal org.joni.Regex
Deprecated.final org.joni.Regex
getPattern
(ThreadContext context) static org.joni.Regex
getRegexpFromCache
(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options) hash
(ThreadContext context) Will return the hash code of this object.initialize_copy
(ThreadContext context, IRubyObject re) rb_reg_init_copyinitialize_m
(IRubyObject arg) Deprecated.initialize_m
(IRubyObject arg0, IRubyObject arg1) Deprecated.initialize_m
(IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) Deprecated.initialize_m
(ThreadContext context, IRubyObject arg) initialize_m
(ThreadContext context, IRubyObject arg0, IRubyObject arg1) initialize_m
(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) inspect
(ThreadContext context) rb_reg_inspectboolean
boolean
boolean
boolean
Deprecated.boolean
isSimpleString
(ThreadContext context) Is the pattern itself a simple US-ASCII string which can be used in simple string searches and can be used outside of the regexp engine?static IRubyObject
last_match
(IRubyObject match) Deprecated.static IRubyObject
last_match
(ThreadContext context, IRubyObject match) rb_reg_last_matchstatic IRubyObject
last_match_s
(ThreadContext context, IRubyObject recv) rb_reg_s_last_match / match_getterstatic IRubyObject
last_match_s
(ThreadContext context, IRubyObject recv, IRubyObject nth) rb_reg_s_last_matchfinal int
length()
static IRubyObject
linear_time_p
(ThreadContext context, IRubyObject recv, IRubyObject[] args) static void
marshalTo
(RubyRegexp regexp, MarshalStream output) Deprecated, for removal: This API element is subject to removal in a future version.static void
marshalTo
(ThreadContext context, RubyRegexp regexp, MarshalDumper output, RubyOutputStream out) static IRubyObject
match_last
(IRubyObject match) Deprecated.static IRubyObject
match_last
(ThreadContext context, IRubyObject matchArg) rb_reg_match_lastfinal IRubyObject
match_m
(ThreadContext context, IRubyObject str, boolean useBackref) match_m
(ThreadContext context, IRubyObject str, Block block) rb_reg_match_mmatch_m
(ThreadContext context, IRubyObject str, IRubyObject pos, Block block) match_p
(ThreadContext context, IRubyObject str) match_p
(ThreadContext context, IRubyObject str, IRubyObject pos) static IRubyObject
match_post
(IRubyObject match) Deprecated.static IRubyObject
match_post
(ThreadContext context, IRubyObject matchArg) rb_reg_match_poststatic IRubyObject
match_pre
(IRubyObject match) Deprecated.static IRubyObject
match_pre
(ThreadContext context, IRubyObject matchArg) rb_reg_match_prestatic int
matcherMatch
(Ruby runtime, org.joni.Matcher matcher, int start, int range, int option) Deprecated.static int
matcherMatch
(ThreadContext context, org.joni.Matcher matcher, int start, int range, int option) static int
matcherSearch
(Ruby runtime, org.joni.Matcher matcher, int start, int range, int option) Deprecated.static int
matcherSearch
(ThreadContext context, org.joni.Matcher matcher, int start, int range, int option) named_captures
(ThreadContext context) rb_reg_named_capturesnames
(ThreadContext context) rb_reg_namesstatic RubyRegexp
newDRegexp
(Ruby runtime, RubyString pattern, int joniOptions) static RubyRegexp
newDRegexp
(Ruby runtime, RubyString pattern, RegexpOptions options) static RubyRegexp
newRegexp
(Ruby runtime, String pattern, RegexpOptions options) static RubyRegexp
static RubyRegexp
static RubyRegexp
newRegexp
(Ruby runtime, ByteList pattern, RegexpOptions options) static RubyRegexp
newRegexpFromStr
(Ruby runtime, RubyString s, int options) static RubyRegexp
newRegexpParser
(Ruby runtime, ByteList pattern, RegexpOptions options) throws RaiseException on error so parser can pick this up and give proper line and line number error as opposed to any non-literal regexp creation which may raise a syntax error but will not have this extra source info in the error messagestatic IRubyObject
nth_match
(int nth, IRubyObject match) Deprecated.static IRubyObject
nth_match
(ThreadContext context, int nth, IRubyObject matchArg) rb_reg_nth_matchop_equal
(ThreadContext context, IRubyObject other) rb_obj_equal Will by default use identity equality to compare objects.op_match
(ThreadContext context, IRubyObject str) rb_obj_pattern_match call-seq: obj =~ other => nil Pattern Match---Overridden by descendents (notablyRegexp
andString
) to provide meaningful pattern-match semantics.op_match2
(ThreadContext context) options()
Deprecated.options
(ThreadContext context) final org.joni.Regex
preparePattern
(RubyString str) Deprecated.final org.joni.Regex
preparePattern
(ThreadContext context, RubyString str) static void
preprocessCheck
(Ruby runtime, ByteList bytes) static RubyString
preprocessDRegexp
(Ruby runtime, RubyString[] strings, int embeddedOptions) Deprecated.static RubyString
preprocessDRegexp
(Ruby runtime, IRubyObject[] strings, RegexpOptions options) static RubyString
preprocessDRegexp
(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, RegexpOptions options) Deprecated.static RubyString
preprocessDRegexp
(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, RegexpOptions options) Deprecated.static RubyString
preprocessDRegexp
(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, RegexpOptions options) Deprecated.static RubyString
preprocessDRegexp
(Ruby runtime, IRubyObject arg0, IRubyObject arg1, RegexpOptions options) Deprecated.static RubyString
preprocessDRegexp
(Ruby runtime, IRubyObject arg0, RegexpOptions options) Deprecated.static RubyString
preprocessDRegexp
(ThreadContext context, RegexpOptions options, IRubyObject arg0) static RubyString
preprocessDRegexp
(ThreadContext context, RegexpOptions options, IRubyObject... args) static RubyString
preprocessDRegexp
(ThreadContext context, RegexpOptions options, IRubyObject arg0, IRubyObject arg1) static RubyString
preprocessDRegexp
(ThreadContext context, RegexpOptions options, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) static RubyString
quote
(ThreadContext context, IRubyObject recv, IRubyObject arg) rb_reg_s_quotefinal RubyRegexp
regexpInitialize
(ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options) Deprecated.final RubyRegexp
regexpInitialize
(ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options, IRubyObject timeout) final int
search
(ThreadContext context, RubyString str, int pos, boolean reverse) MRI: rb_reg_search This version uses current thread context to hold the resulting match data.final int
search
(ThreadContext context, RubyString str, int pos, boolean reverse, IRubyObject[] holder) Deprecated.final int
searchString
(ThreadContext context, RubyString str, int pos, boolean reverse) Search the given string with this Regexp.void
setEncoding
(org.jcodings.Encoding encoding) void
void
boolean
source()
Deprecated.source
(ThreadContext context) rb_reg_sourcefinal RubyBoolean
startWithP
(ThreadContext context, RubyString str) Deprecated.timeout
(ThreadContext context) static IRubyObject
timeout
(ThreadContext context, IRubyObject recv) static IRubyObject
timeout_set
(ThreadContext context, IRubyObject recv, IRubyObject timeout) to_s()
Deprecated.to_s
(ThreadContext context) static IRubyObject
try_convert
(ThreadContext context, IRubyObject recv, IRubyObject args) static IRubyObject
union
(ThreadContext context, IRubyObject recv, IRubyObject[] args) rb_reg_s_unionstatic RubyRegexp
unmarshalFrom
(UnmarshalStream input) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class org.jruby.RubyObject
attachToObjectSpace, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, callInit, convertToType, dig, dig1, dig2, eqlInternal, equalInternal, equals, finishObjectClass, hashCode, inspect, op_eqq, puts, specificEval, toRubyString, toString
Methods inherited from class org.jruby.RubyBasicObject
addFinalizer, addFinalizer, anyToString, asJavaString, asString, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callSuper, checkArrayType, checkCallMethod, checkCallMethod, checkFrozen, checkStringType, cloneSetup, compareTo, convertToArray, convertToFloat, convertToHash, convertToInteger, convertToInteger, convertToInteger, convertToString, copyInstanceVariablesInto, copySpecialInstanceVariables, dataGetStruct, dataGetStructChecked, dataWrapStruct, decode, display, dup, dupFinalizer, dupSetup, ensureInstanceVariablesSettable, eql, eql_p, eql_p, equal_p, evalUnder, extend, fastGetInstanceVariable, fastGetInternalVariable, fastHasInstanceVariable, fastHasInternalVariable, fastSetInstanceVariable, fastSetInternalVariable, finishBasicObjectClass, forEachInstanceVariable, forEachInstanceVariableName, freeze, frozen_p, getCurrentContext, getFFIHandle, getFlag, getInstanceEvalClass, getInstanceEvalClass, getInstanceVariable, getInstanceVariableList, getInstanceVariableNameList, getInstanceVariables, getInternalVariable, getInternalVariables, getJavaClass, getMarshalVariableList, getMetaClass, getMetaClass, getNativeHandle, getNativeTypeIndex, getObjectId, getRuntime, getSingletonClass, getSingletonClassClone, getSingletonClassCloneAndAttach, getSingletonClassCloneAndAttach, getType, getVariable, getVariableCount, getVariableList, getVariableNameList, hash, hashyInspect, hasInstanceVariable, hasInstanceVariables, hasInternalVariable, hasVariables, id, infectBy, initialize, initialize_copy, inspect, inspectHashCode, instance_eval, instance_eval, instance_eval, instance_eval, instance_eval, instance_exec, instance_of_p, instance_variable_defined_p, instance_variable_get, instance_variable_set, instance_variables, isBuiltin, isClass, isFalse, isFrozen, isImmediate, isModule, isNil, isSpecialConst, isSpecialObject, isTaint, isTrue, isUntrusted, kind_of_p, makeMetaClass, makeMetaClass, makeMetaClassBootstrap, method, method, method, method_missing, methods, methods, nil_p, nonFixnumHashCode, nonFixnumHashCode, OBJ_INIT_COPY, objInitCopy, op_cmp, op_not, op_not_equal, op_not_match, private_methods, protected_methods, public_methods, rbClone, rbClone, rbInspect, remove_instance_variable, removeFinalizers, removeInstanceVariable, removeInternalVariable, respond_to_p, respond_to_p, respondsTo, respondsToMissing, respondsToMissing, send, send, send, send, send, setFFIHandle, setFlag, setFrozen, setInstanceVariable, setInternalVariable, setMetaClass, setNativeHandle, setTaint, setUntrusted, setVariable, singleton_method, singleton_method, singleton_method_added, singleton_method_removed, singleton_method_undefined, singleton_methods, singletonClass, specificEval, specificEval, specificEval, specificEval, syncVariables, syncVariables, taint, taint, tainted_p, testFrozen, testFrozen, to_a, to_a, toJava, trust, type, untaint, untrust, untrusted_p, validateInstanceVariable, validateInstanceVariable, validateInstanceVariable, variableTableContains, variableTableFastContains, variableTableFastFetch, variableTableFastStore, variableTableFetch, variableTableRemove, variableTableStore, variableTableSync, yieldUnder, yieldUnder
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jruby.runtime.builtin.IRubyObject
checkStringType19, dup, marshalLiveVariables
-
Field Details
-
ARG_ENCODING_FIXED
public static final int ARG_ENCODING_FIXED- See Also:
-
ARG_ENCODING_NONE
public static final int ARG_ENCODING_NONE- See Also:
-
-
Constructor Details
-
RubyRegexp
-
-
Method Details
-
setLiteral
public void setLiteral() -
clearLiteral
public void clearLiteral() -
isLiteral
public boolean isLiteral() -
isKCodeDefault
public boolean isKCodeDefault() -
setEncodingNone
public void setEncodingNone() -
clearEncodingNone
public void clearEncodingNone() -
isEncodingNone
public boolean isEncodingNone() -
getKCode
-
getEncoding
public org.jcodings.Encoding getEncoding()- Specified by:
getEncoding
in interfaceEncodingCapable
-
setEncoding
public void setEncoding(org.jcodings.Encoding encoding) - Specified by:
setEncoding
in interfaceEncodingCapable
-
shouldMarshalEncoding
public boolean shouldMarshalEncoding()- Specified by:
shouldMarshalEncoding
in interfaceMarshalEncoding
-
getMarshalEncoding
public org.jcodings.Encoding getMarshalEncoding()- Specified by:
getMarshalEncoding
in interfaceMarshalEncoding
-
getRegexpFromCache
public static org.joni.Regex getRegexpFromCache(Ruby runtime, ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options) -
createRegexpClass
-
matcherSearch
public static int matcherSearch(ThreadContext context, org.joni.Matcher matcher, int start, int range, int option) -
matcherMatch
public static int matcherMatch(ThreadContext context, org.joni.Matcher matcher, int start, int range, int option) -
matcherSearch
@Deprecated public static int matcherSearch(Ruby runtime, org.joni.Matcher matcher, int start, int range, int option) Deprecated. -
matcherMatch
@Deprecated public static int matcherMatch(Ruby runtime, org.joni.Matcher matcher, int start, int range, int option) Deprecated. -
getNativeClassIndex
Description copied from class:RubyObject
This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are. Will generally return a value from org.jruby.runtime.ClassIndex- Specified by:
getNativeClassIndex
in interfaceCoreObjectType
- Overrides:
getNativeClassIndex
in classRubyObject
- Returns:
- the ClassIndex of the native type this object was constructed from
- See Also:
-
newRegexp
-
newRegexp
-
newRegexp
-
newRegexpParser
throws RaiseException on error so parser can pick this up and give proper line and line number error as opposed to any non-literal regexp creation which may raise a syntax error but will not have this extra source info in the error message -
newDRegexp
-
newDRegexp
-
newRegexp
-
newRegexpFromStr
-
getOptions
Deprecated. -
getOptions
rb_reg_options -
getPattern
Deprecated. -
getPattern
-
preparePattern
Deprecated. -
preparePattern
-
preprocessCheck
-
preprocessDRegexp
@Deprecated public static RubyString preprocessDRegexp(Ruby runtime, RubyString[] strings, int embeddedOptions) Deprecated. -
preprocessDRegexp
public static RubyString preprocessDRegexp(Ruby runtime, IRubyObject[] strings, RegexpOptions options) -
preprocessDRegexp
public static RubyString preprocessDRegexp(ThreadContext context, RegexpOptions options, IRubyObject... args) -
preprocessDRegexp
public static RubyString preprocessDRegexp(ThreadContext context, RegexpOptions options, IRubyObject arg0) -
preprocessDRegexp
@Deprecated public static RubyString preprocessDRegexp(Ruby runtime, IRubyObject arg0, RegexpOptions options) Deprecated. -
preprocessDRegexp
public static RubyString preprocessDRegexp(ThreadContext context, RegexpOptions options, IRubyObject arg0, IRubyObject arg1) -
preprocessDRegexp
@Deprecated public static RubyString preprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, RegexpOptions options) Deprecated. -
preprocessDRegexp
public static RubyString preprocessDRegexp(ThreadContext context, RegexpOptions options, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
preprocessDRegexp
@Deprecated public static RubyString preprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, RegexpOptions options) Deprecated. -
preprocessDRegexp
@Deprecated public static RubyString preprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, RegexpOptions options) Deprecated. -
preprocessDRegexp
@Deprecated public static RubyString preprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, RegexpOptions options) Deprecated. -
try_convert
-
quote
rb_reg_s_quote -
last_match_s
rb_reg_s_last_match / match_getter -
last_match_s
rb_reg_s_last_match -
union
rb_reg_s_union -
initialize_copy
rb_reg_init_copy- Overrides:
initialize_copy
in classRubyBasicObject
- Parameters:
context
- the thread contextre
- the original- Returns:
- a copy unless the same thing
-
initialize_m
Deprecated. -
initialize_m
-
initialize_m
Deprecated. -
initialize_m
-
initialize_m
@Deprecated(since="10.0") public IRubyObject initialize_m(IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) Deprecated. -
initialize_m
public IRubyObject initialize_m(ThreadContext context, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) -
regexpInitialize
@Deprecated public final RubyRegexp regexpInitialize(ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options) Deprecated. -
regexpInitialize
public final RubyRegexp regexpInitialize(ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options, IRubyObject timeout) -
hash
Description copied from class:RubyBasicObject
Will return the hash code of this object. In comparison to MRI, this method will use the Java identity hash code instead of using rb_obj_id, since the usage of id in JRuby will incur the cost of some. ObjectSpace maintenance.- Overrides:
hash
in classRubyBasicObject
- Parameters:
context
- the current thread context- Returns:
- the hash value
-
op_equal
Description copied from class:RubyBasicObject
rb_obj_equal Will by default use identity equality to compare objects. This follows the Ruby semantics. The name of this method doesn't follow the convention because hierarchy problems- Specified by:
op_equal
in interfaceIRubyObject
- Overrides:
op_equal
in classRubyBasicObject
-
op_match2
-
eqq
rb_reg_eqq -
op_match
Description copied from class:RubyBasicObject
rb_obj_pattern_match call-seq: obj =~ other => nil Pattern Match---Overridden by descendents (notablyRegexp
andString
) to provide meaningful pattern-match semantics.- Overrides:
op_match
in classRubyBasicObject
- Parameters:
context
- the thread contextstr
- arg- Returns:
- true if matches (always nil)
-
match_m
rb_reg_match_m -
match_m
-
match_m
-
match_p
-
match_p
-
timeout_set
-
timeout
-
timeout
-
search
MRI: rb_reg_search This version uses current thread context to hold the resulting match data. -
startWithP
Deprecated. -
searchString
Search the given string with this Regexp. MRI: rb_reg_search0 without backref updating -
options
-
options
Deprecated. -
casefold_p
-
source
rb_reg_source -
source
Deprecated. -
rawSource
-
length
public final int length() -
inspect
rb_reg_inspect- Specified by:
inspect
in interfaceIRubyObject
- Overrides:
inspect
in classRubyBasicObject
-
to_s
Deprecated.- Overrides:
to_s
in classRubyBasicObject
- Returns:
- ""
-
to_s
- Overrides:
to_s
in classRubyBasicObject
-
getNames
returns all names in a regexp pattern as id (8859_1) strings- Returns:
- array of id strings.
-
names
rb_reg_names -
named_captures
rb_reg_named_captures -
encoding
-
fixed_encoding_p
-
linear_time_p
public static IRubyObject linear_time_p(ThreadContext context, IRubyObject recv, IRubyObject[] args) -
nth_match
Deprecated. -
nth_match
rb_reg_nth_match -
last_match
Deprecated. -
last_match
rb_reg_last_match -
match_pre
Deprecated. -
match_pre
rb_reg_match_pre -
match_post
Deprecated. -
match_post
rb_reg_match_post -
match_last
Deprecated. -
match_last
rb_reg_match_last -
unmarshalFrom
@Deprecated(forRemoval=true) public static RubyRegexp unmarshalFrom(UnmarshalStream input) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
marshalTo
@Deprecated(since="10.0", forRemoval=true) public static void marshalTo(RubyRegexp regexp, MarshalStream output) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-
marshalTo
public static void marshalTo(ThreadContext context, RubyRegexp regexp, MarshalDumper output, RubyOutputStream out) -
search
@Deprecated public final int search(ThreadContext context, RubyString str, int pos, boolean reverse, IRubyObject[] holder) Deprecated. -
getBackRef
Deprecated. -
isSimpleString
Deprecated. -
isSimpleString
Is the pattern itself a simple US-ASCII string which can be used in simple string searches and can be used outside of the regexp engine?
-