Top Inners Fields Constructors Methods
org.jruby

public Class RubyRegexp

extends RubyObject
implements ReOptions, EncodingCapable, MarshalEncoding
Class Inheritance
All Implemented Interfaces
org.jruby.runtime.encoding.MarshalEncoding, org.jruby.runtime.encoding.EncodingCapable, org.jruby.parser.ReOptions
Annotations
@JRubyClass
name:Regexp
Imports
org.jcodings.Encoding, org.jcodings.specific.ASCIIEncoding, .USASCIIEncoding, org.joni.Matcher, .NameEntry, .Option, .Regex, .Region, .Syntax, .WarnCallback, org.joni.exception.JOniException, .TimeoutException, org.jruby.anno.JRubyClass, .JRubyMethod, org.jruby.api.Convert, org.jruby.exceptions.RaiseException, org.jruby.parser.ReOptions, org.jruby.runtime.Block, .ClassIndex, .ThreadContext, .Visibility, org.jruby.runtime.builtin.IRubyObject, org.jruby.runtime.encoding.EncodingCapable, .MarshalEncoding, org.jruby.runtime.marshal.MarshalDumper, org.jruby.util.ByteList, .KCode, .RegexpOptions, .RegexpSupport, .StringSupport, .TypeConverter, org.jruby.util.cli.Options, org.jruby.util.collections.WeakValuedMap, org.jruby.util.io.EncodingUtils, .RubyOutputStream, java.util.Iterator

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static record

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
private static final int
private static double
private RegexpOptions
pack-priv Regex
pack-priv static final WeakValuedMap<ByteList, Regex>
pack-priv static final WeakValuedMap<ByteList, Regex>
private static final int
QUOTED_V

rb_reg_quote

pack-priv static final WeakValuedMap<ByteList, Regex>
private ByteList
private IRubyObject
private static final ThreadLocal<IRubyObject[]>
Inherited from org.jruby.RubyObject:
IVAR_INSPECTING_OBJECT_ALLOCATOROBJECT_ALLOCATORREIFYING_OBJECT_ALLOCATOR

Constructor Summary

AccessConstructor and Description
private
RubyRegexp(Ruby runtime, RubyClass klass)

used by allocator

pack-priv
RubyRegexp(Ruby runtime)

default constructor

public
RubyRegexp(Ruby runtime, Regex pattern, ByteList str, RegexpOptions options)

private
RubyRegexp(Ruby runtime, ByteList str)

private
RubyRegexp(Ruby runtime, ByteList str, RegexpOptions options)

Method Summary

Modifier and TypeMethod and Description
pack-priv final int
adjustStartPos(ThreadContext context, RubyString str, int pos, boolean reverse)

private static int
adjustStartPosInternal(RubyString str, Encoding enc, int pos, boolean reverse)

private static final int
ASCGET(boolean acompat, byte[] sBytes, int s, int e, int[] cl, Encoding strEnc)

public IRubyObject
private void
pack-priv Encoding
public void
public void
pack-priv static RubyMatchData
createMatchData(ThreadContext context, RubyString str, Matcher matcher, Regex pattern)

pack-priv static RubyMatchData
createMatchData(ThreadContext context, RubyString str, int pos, RubyString pattern)

public static RubyClass
public IRubyObject
private static void
encodingMatchError(ThreadContext context, Regex pattern, Encoding strEnc)

public IRubyObject
eqq(ThreadContext context, IRubyObject arg)

rb_reg_eqq

private static RubyRegexp.RegexpArgs
public IRubyObject
public static IRubyObject
getBackRef(ThreadContext context)
Deprecated

public Encoding
public KCode
public Encoding
public String[]

Returns:

array of id strings.
getNames
()

returns all names in a regexp pattern as id (8859_1) strings

public ClassIndex
getNativeClassIndex()

Overrides org.jruby.RubyObject.getNativeClassIndex.

Implements org.jruby.runtime.marshal.CoreObjectType.getNativeClassIndex.

This is overridden in the other concrete Java builtins to provide a fast way to determine what type they are.

public final RegexpOptions
getOptions()
Deprecated since 10.0.

public final RegexpOptions
getOptions(ThreadContext context)

rb_reg_options

public final Regex
getPattern()
Deprecated since 10.0.

public final Regex
private static Regex
pack-priv static Regex
public static Regex
getRegexpFromCache(Ruby runtime, ByteList bytes, Encoding enc, RegexpOptions options)

private long
public RubyFixnum
hash(ThreadContext
the current thread context
context
)

Overrides org.jruby.RubyBasicObject.hash.

Will return the hash code of this object.

public IRubyObject
initialize_copy(ThreadContext
the thread context
context
,
IRubyObject
the original
re
)

Overrides org.jruby.RubyBasicObject.initialize_copy.

rb_reg_init_copy

public IRubyObject
initialize_m(IRubyObject arg)
Deprecated since 10.0.

public IRubyObject
public IRubyObject
initialize_m(IRubyObject arg0, IRubyObject arg1)
Deprecated since 10.0.

public IRubyObject
public IRubyObject
initialize_m(IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
Deprecated since 10.0.

public IRubyObject
private IRubyObject
initializeByRegexp(ThreadContext context, RubyRegexp regexp, IRubyObject timeoutProvided)

public IRubyObject
public boolean
private boolean
public boolean
public boolean
public boolean
isSimpleString()
Deprecated since 10.0.

public 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?

public static IRubyObject
last_match(IRubyObject match)
Deprecated since 10.0.

public static IRubyObject
last_match(ThreadContext context, IRubyObject match)

rb_reg_last_match

public static IRubyObject
last_match_s(ThreadContext context, IRubyObject recv)

rb_reg_s_last_match / match_getter

public static IRubyObject
last_match_s(ThreadContext context, IRubyObject recv, IRubyObject nth)

rb_reg_s_last_match

public final int
public static IRubyObject
private static Regex
makeRegexp(Ruby runtime, ByteList bytes, RegexpOptions options, Encoding enc)

public static void
marshalTo(RubyRegexp regexp, MarshalStream output)
Deprecated for removal since 10.0.

public static void
public static IRubyObject
match_last(IRubyObject match)
Deprecated since 10.0.

public static IRubyObject
match_last(ThreadContext context, IRubyObject matchArg)

rb_reg_match_last

public IRubyObject
match_m(ThreadContext context, IRubyObject str, Block block)

rb_reg_match_m

public IRubyObject
public final IRubyObject
match_m(ThreadContext context, IRubyObject str, boolean useBackref)

public IRubyObject
public IRubyObject
public static IRubyObject
match_post(IRubyObject match)
Deprecated since 10.0.

public static IRubyObject
match_post(ThreadContext context, IRubyObject matchArg)

rb_reg_match_post

public static IRubyObject
match_pre(IRubyObject match)
Deprecated since 10.0.

public static IRubyObject
match_pre(ThreadContext context, IRubyObject matchArg)

rb_reg_match_pre

private IRubyObject
matchCommon(ThreadContext context, IRubyObject str, int pos, boolean setBackref, Block block)

public static int
matcherMatch(ThreadContext context, Matcher matcher, int start, int range, int option)

public static int
matcherMatch(Ruby runtime, Matcher matcher, int start, int range, int option)
Deprecated

public static int
matcherSearch(ThreadContext context, Matcher matcher, int start, int range, int option)

public static int
matcherSearch(Ruby runtime, Matcher matcher, int start, int range, int option)
Deprecated

private RubyBoolean
matchP(ThreadContext context, IRubyObject arg, int pos)

pack-priv final RubyBoolean
matchP(ThreadContext context, RubyString str, int pos)

private int
matchPos(ThreadContext
thread context
context
,
IRubyObject
the stringlike to match
arg
,
RubyString[]
an out param to hold the coerced string; ignored if null
strp
,
boolean
whether to update the current execution frame's backref
useBackref
,
int
the position from which to start matching
pos
)

MRI: reg_match_pos

public IRubyObject
named_captures(ThreadContext context)

rb_reg_named_captures

public IRubyObject
names(ThreadContext context)

rb_reg_names

public static RubyRegexp
newDRegexp(Ruby runtime, RubyString pattern, RegexpOptions options)

public static RubyRegexp
newDRegexp(Ruby runtime, RubyString pattern, int joniOptions)

pack-priv static RubyRegexp
newDummyRegexp(Ruby runtime, Regex regex)

public static RubyRegexp
newRegexp(Ruby runtime, String pattern, RegexpOptions options)

public static RubyRegexp
newRegexp(Ruby runtime, ByteList pattern, int options)

public static RubyRegexp
newRegexp(Ruby runtime, ByteList pattern, RegexpOptions options)

public static RubyRegexp
newRegexp(Ruby runtime, ByteList pattern)

pack-priv static RubyRegexp
newRegexp(Ruby runtime, ByteList str, Regex pattern)

public static RubyRegexp
newRegexpFromStr(Ruby runtime, RubyString s, int options)

public 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 message

public static IRubyObject
nth_match(int nth, IRubyObject match)
Deprecated since 10.0.

public static IRubyObject
nth_match(ThreadContext context, int nth, IRubyObject matchArg)

rb_reg_nth_match

pack-priv static IRubyObject
nth_match(ThreadContext context, int nth, RubyMatchData match)

private static int
public IRubyObject
op_equal(ThreadContext context, IRubyObject other)

Overrides org.jruby.RubyBasicObject.op_equal.

Implements org.jruby.runtime.builtin.IRubyObject.op_equal.

rb_obj_equal Will by default use identity equality to compare objects.

public IRubyObject
op_match(ThreadContext
the thread context
context
,
IRubyObject
arg
str
)

Overrides org.jruby.RubyBasicObject.op_match.

rb_obj_pattern_match call-seq: obj =~ other => nil Pattern Match---Overridden by descendents (notably Regexp and String) to provide meaningful pattern-match semantics.

public IRubyObject
private static RubyString
private static IRubyObject
public IRubyObject
public IRubyObject
options()
Deprecated

private Encoding
prepareEncoding(ThreadContext context, RubyString str, boolean warn)

public final Regex
preparePattern(RubyString str)
Deprecated since 10.0.

public final Regex
public static void
preprocessCheck(Ruby runtime, ByteList bytes)

public static RubyString
preprocessDRegexp(Ruby runtime, RubyString[] strings, int embeddedOptions)
Deprecated

public static RubyString
preprocessDRegexp(Ruby runtime, IRubyObject[] strings, RegexpOptions options)

public static RubyString
public static RubyString
public static RubyString
preprocessDRegexp(Ruby runtime, IRubyObject arg0, RegexpOptions options)
Deprecated

public static RubyString
public static RubyString
preprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, RegexpOptions options)
Deprecated

public static RubyString
public static RubyString
preprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, RegexpOptions options)
Deprecated

public static RubyString
preprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, RegexpOptions options)
Deprecated

public static RubyString
preprocessDRegexp(Ruby runtime, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, RegexpOptions options)
Deprecated

private static void
preprocessLight(ThreadContext
the current context
context
,
ByteList
string to preprocess
str
,
Encoding
string's encoding
enc
,
Encoding[]
new encoding after fixing
fixedEnc
,
RegexpSupport.ErrorMode
mode of errors
mode
)

Preprocess the given string for use in regexp, raising errors for encoding incompatibilities that arise.

private static Encoding
processDRegexpElement(ThreadContext context, RegexpOptions options, Encoding regexpEnc, Encoding[] fixedEnc, RubyString str)

private static RubyString
processElementIntoResult(ThreadContext context, RubyString result, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, RegexpOptions options, Encoding regexpEnc, Encoding[] fixedEnc)

private static RubyString
processElementIntoResult(ThreadContext context, RubyString result, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, RegexpOptions options, Encoding regexpEnc, Encoding[] fixedEnc)

private static RubyString
processElementIntoResult(ThreadContext context, RubyString result, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, RegexpOptions options, Encoding regexpEnc, Encoding[] fixedEnc)

private static RubyString
processElementIntoResult(ThreadContext context, RubyString result, IRubyObject arg0, IRubyObject arg1, RegexpOptions options, Encoding regexpEnc, Encoding[] fixedEnc)

private static RubyString
processElementIntoResult(ThreadContext context, RubyString result, IRubyObject arg0, RegexpOptions options, Encoding regexpEnc, Encoding[] fixedEnc)

private static IRubyObject
public static RubyString
quote(ThreadContext context, IRubyObject recv, IRubyObject arg)

rb_reg_s_quote

pack-priv static ByteList
quote(final RubyString str)

pack-priv static ByteList
quote(ByteList bs, boolean asciiOnly)

public ByteList
public final RubyRegexp
regexpInitialize(ByteList bytes, Encoding enc, RegexpOptions options)
Deprecated

public final RubyRegexp
private RubyRegexp
private static IRubyObject
regOperand(ThreadContext context, IRubyObject str, boolean check)

pack-priv static RubyString
regsub(ThreadContext context, RubyString str, RubyString src, Regex pattern, Matcher matcher)

pack-priv static RubyString
regsub(ThreadContext context, RubyString str, RubyString src, Regex pattern, Region regs, final int begin, final int end)

public 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.

public final int
search(ThreadContext context, RubyString str, int pos, boolean reverse, IRubyObject[] holder)
Deprecated

public final int
searchString(ThreadContext context, RubyString str, int pos, boolean reverse)

Search the given string with this Regexp.

public void
public void
public void
public boolean
public IRubyObject
source(ThreadContext context)

rb_reg_source

public IRubyObject
source()
Deprecated

pack-priv final boolean
public final RubyBoolean
startWithP(ThreadContext context, RubyString str)
Deprecated

public static IRubyObject
public IRubyObject
public static IRubyObject
private IRubyObject
public RubyString
to_s()

Overrides org.jruby.RubyBasicObject.to_s.

Deprecated since 10.0.

public RubyString
public static IRubyObject
public static IRubyObject
union(ThreadContext context, IRubyObject recv, IRubyObject[] args)

rb_reg_s_union

public static RubyRegexp
unmarshalFrom(UnmarshalStream input)
Deprecated for removal.

Inherited from org.jruby.RubyObject:
attachToObjectSpacecallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitcallInitconvertToTypedigdig1dig2eqlInternalequalInternalequalsfinishObjectClasshashCodeinspectop_eqqputsspecificEvaltoRubyStringtoString