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.DataNested classes/interfaces inherited from class org.jruby.RubyBasicObject
RubyBasicObject.Finalizer -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from class org.jruby.RubyObject
IVAR_INSPECTING_OBJECT_ALLOCATOR, OBJECT_ALLOCATOR, REIFYING_OBJECT_ALLOCATORFields 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, varTableStampFields inherited from interface org.jruby.runtime.builtin.IRubyObject
NULL_ARRAYFields 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) voidvoidstatic RubyClasscreateRegexpClass(ThreadContext context, RubyClass Object) encoding(ThreadContext context) eqq(ThreadContext context, IRubyObject arg) rb_reg_eqqfixed_encoding_p(ThreadContext context) static IRubyObjectgetBackRef(ThreadContext context) Deprecated.org.jcodings.EncodinggetKCode()org.jcodings.EncodingString[]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 RegexpOptionsDeprecated.final RegexpOptionsgetOptions(ThreadContext context) rb_reg_optionsfinal org.joni.RegexDeprecated.final org.joni.RegexgetPattern(ThreadContext context) static org.joni.RegexgetRegexpFromCache(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_inspectbooleanbooleanbooleanbooleanDeprecated.booleanisSimpleString(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 IRubyObjectlast_match(IRubyObject match) Deprecated.static IRubyObjectlast_match(ThreadContext context, IRubyObject match) rb_reg_last_matchstatic IRubyObjectlast_match_s(ThreadContext context, IRubyObject recv) rb_reg_s_last_match / match_getterstatic IRubyObjectlast_match_s(ThreadContext context, IRubyObject recv, IRubyObject nth) rb_reg_s_last_matchfinal intlength()static IRubyObjectlinear_time_p(ThreadContext context, IRubyObject recv, IRubyObject[] args) static voidmarshalTo(RubyRegexp regexp, MarshalStream output) Deprecated, for removal: This API element is subject to removal in a future version.static voidmarshalTo(ThreadContext context, RubyRegexp regexp, MarshalDumper output, RubyOutputStream out) static IRubyObjectmatch_last(IRubyObject match) Deprecated.static IRubyObjectmatch_last(ThreadContext context, IRubyObject matchArg) rb_reg_match_lastfinal IRubyObjectmatch_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 IRubyObjectmatch_post(IRubyObject match) Deprecated.static IRubyObjectmatch_post(ThreadContext context, IRubyObject matchArg) rb_reg_match_poststatic IRubyObjectmatch_pre(IRubyObject match) Deprecated.static IRubyObjectmatch_pre(ThreadContext context, IRubyObject matchArg) rb_reg_match_prestatic intmatcherMatch(Ruby runtime, org.joni.Matcher matcher, int start, int range, int option) Deprecated.static intmatcherMatch(ThreadContext context, org.joni.Matcher matcher, int start, int range, int option) static intmatcherSearch(Ruby runtime, org.joni.Matcher matcher, int start, int range, int option) Deprecated.static intmatcherSearch(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 RubyRegexpnewDRegexp(Ruby runtime, RubyString pattern, int joniOptions) static RubyRegexpnewDRegexp(Ruby runtime, RubyString pattern, RegexpOptions options) static RubyRegexpnewRegexp(Ruby runtime, String pattern, RegexpOptions options) static RubyRegexpstatic RubyRegexpstatic RubyRegexpnewRegexp(Ruby runtime, ByteList pattern, RegexpOptions options) static RubyRegexpnewRegexpFromStr(Ruby runtime, RubyString s, int options) static RubyRegexpnewRegexpParser(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 IRubyObjectnth_match(int nth, IRubyObject match) Deprecated.static IRubyObjectnth_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 (notablyRegexpandString) to provide meaningful pattern-match semantics.op_match2(ThreadContext context) options()Deprecated.options(ThreadContext context) final org.joni.RegexpreparePattern(RubyString str) Deprecated.final org.joni.RegexpreparePattern(ThreadContext context, RubyString str) static voidpreprocessCheck(Ruby runtime, ByteList bytes) static RubyStringpreprocessDRegexp(Ruby runtime, RubyString[] strings, int embeddedOptions) Deprecated.static RubyStringpreprocessDRegexp(Ruby runtime, IRubyObject[] strings, RegexpOptions options) static RubyStringpreprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, RegexpOptions options) Deprecated.static RubyStringpreprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, RegexpOptions options) Deprecated.static RubyStringpreprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, RegexpOptions options) Deprecated.static RubyStringpreprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, RegexpOptions options) Deprecated.static RubyStringpreprocessDRegexp(Ruby runtime, IRubyObject arg0, RegexpOptions options) Deprecated.static RubyStringpreprocessDRegexp(ThreadContext context, RegexpOptions options, IRubyObject arg0) static RubyStringpreprocessDRegexp(ThreadContext context, RegexpOptions options, IRubyObject... args) static RubyStringpreprocessDRegexp(ThreadContext context, RegexpOptions options, IRubyObject arg0, IRubyObject arg1) static RubyStringpreprocessDRegexp(ThreadContext context, RegexpOptions options, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) static RubyStringquote(ThreadContext context, IRubyObject recv, IRubyObject arg) rb_reg_s_quotefinal RubyRegexpregexpInitialize(ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options) Deprecated.final RubyRegexpregexpInitialize(ByteList bytes, org.jcodings.Encoding enc, RegexpOptions options, IRubyObject timeout) final intsearch(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 intsearch(ThreadContext context, RubyString str, int pos, boolean reverse, IRubyObject[] holder) Deprecated.final intsearchString(ThreadContext context, RubyString str, int pos, boolean reverse) Search the given string with this Regexp.voidsetEncoding(org.jcodings.Encoding encoding) voidvoidbooleansource()Deprecated.source(ThreadContext context) rb_reg_sourcefinal RubyBooleanstartWithP(ThreadContext context, RubyString str) Deprecated.timeout(ThreadContext context) static IRubyObjecttimeout(ThreadContext context, IRubyObject recv) static IRubyObjecttimeout_set(ThreadContext context, IRubyObject recv, IRubyObject timeout) to_s()Deprecated.to_s(ThreadContext context) static IRubyObjecttry_convert(ThreadContext context, IRubyObject recv, IRubyObject args) static IRubyObjectunion(ThreadContext context, IRubyObject recv, IRubyObject[] args) rb_reg_s_unionstatic RubyRegexpunmarshalFrom(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, toStringMethods 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, yieldUnderMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:
getEncodingin interfaceEncodingCapable
-
setEncoding
public void setEncoding(org.jcodings.Encoding encoding) - Specified by:
setEncodingin interfaceEncodingCapable
-
shouldMarshalEncoding
public boolean shouldMarshalEncoding()- Specified by:
shouldMarshalEncodingin interfaceMarshalEncoding
-
getMarshalEncoding
public org.jcodings.Encoding getMarshalEncoding()- Specified by:
getMarshalEncodingin 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:RubyObjectThis 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:
getNativeClassIndexin interfaceCoreObjectType- Overrides:
getNativeClassIndexin 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_copyin 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:RubyBasicObjectWill 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:
hashin classRubyBasicObject- Parameters:
context- the current thread context- Returns:
- the hash value
-
op_equal
Description copied from class:RubyBasicObjectrb_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_equalin interfaceIRubyObject- Overrides:
op_equalin classRubyBasicObject
-
op_match2
-
eqq
rb_reg_eqq -
op_match
Description copied from class:RubyBasicObjectrb_obj_pattern_match call-seq: obj =~ other => nil Pattern Match---Overridden by descendents (notablyRegexpandString) to provide meaningful pattern-match semantics.- Overrides:
op_matchin 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:
inspectin interfaceIRubyObject- Overrides:
inspectin classRubyBasicObject
-
to_s
Deprecated.- Overrides:
to_sin classRubyBasicObject- Returns:
- ""
-
to_s
- Overrides:
to_sin 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?
-