NativeRegExpExecResult(final RegExpResult result, final Global global) { super(global.getArrayPrototype(), $nasgenmap$); setIsArray(); this.setArray(ArrayData.allocate(result.getGroups().clone())); this.index = result.getIndex(); this.input = result.getInput(); }
/** * Executes a search for a match within a string based on a regular * expression. It returns an array of information or null if no match is * found. * * @param string String to match. * @return NativeArray of matches, string or null. */ public NativeRegExpExecResult exec(final String string) { final RegExpResult match = execInner(string); if (match == null) { return null; } return new NativeRegExpExecResult(match, globalObject); }
/** * Tests for a match in a string. It returns the index of the match, or -1 * if not found. * * @param string String to match. * @return Index of match. */ int search(final String string) { final RegExpResult match = execInner(string); if (match == null) { return -1; } return match.getIndex(); }
NativeRegExpExecResult(final RegExpResult result, final Global global) { super(global.getArrayPrototype(), global.getRegExpExecResultMap()); setIsArray(); this.setArray(ArrayData.allocate(result.getGroups().clone())); this.index = result.getIndex(); this.input = result.getInput(); }
/** * Executes a search for a match within a string based on a regular * expression. It returns an array of information or null if no match is * found. * * @param string String to match. * @return NativeArray of matches, string or null. */ public Object exec(final String string) { final RegExpResult match = execInner(string); if (match == null) { return null; } return new NativeRegExpExecResult(match, globalObject); }
/** * Tests for a match in a string. It returns the index of the match, or -1 * if not found. * * @param string String to match. * @return Index of match. */ Object search(final String string) { final RegExpResult match = execInner(string); if (match == null) { return -1; } return match.getIndex(); }
RegExpResult getLastRegExpResult() { return lastRegExpResult; }
void setLastRegExpResult(final RegExpResult regExpResult) { this.lastRegExpResult = regExpResult; }
/** * Getter for non-standard RegExp.input property. * @param self self object * @return last regexp input */ @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "input") public static Object getLastInput(final Object self) { final RegExpResult match = Global.instance().getLastRegExpResult(); return match == null ? "" : match.getInput(); }
/** * Getter for non-standard RegExp.lastMatch property. * @param self self object * @return last regexp input */ @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "lastMatch") public static Object getLastMatch(final Object self) { final RegExpResult match = Global.instance().getLastRegExpResult(); return match == null ? "" : match.getGroup(0); }
/** * Getter for non-standard RegExp.lastParen property. * @param self self object * @return last regexp input */ @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "lastParen") public static Object getLastParen(final Object self) { final RegExpResult match = Global.instance().getLastRegExpResult(); return match == null ? "" : match.getLastParen(); }
/** * Getter for non-standard RegExp.leftContext property. * @param self self object * @return last regexp input */ @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "leftContext") public static Object getLeftContext(final Object self) { final RegExpResult match = Global.instance().getLastRegExpResult(); return match == null ? "" : match.getInput().substring(0, match.getIndex()); }
/** * Getter for non-standard RegExp.rightContext property. * @param self self object * @return last regexp input */ @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "rightContext") public static Object getRightContext(final Object self) { final RegExpResult match = Global.instance().getLastRegExpResult(); return match == null ? "" : match.getInput().substring(match.getIndex() + match.length()); }
/** * Getter for non-standard RegExp.$1 property. * @param self self object * @return last regexp input */ @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$1") public static Object getGroup1(final Object self) { final RegExpResult match = Global.instance().getLastRegExpResult(); return match == null ? "" : match.getGroup(1); }
/** * Getter for non-standard RegExp.$2 property. * @param self self object * @return last regexp input */ @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$2") public static Object getGroup2(final Object self) { final RegExpResult match = Global.instance().getLastRegExpResult(); return match == null ? "" : match.getGroup(2); }
/** * Getter for non-standard RegExp.$3 property. * @param self self object * @return last regexp input */ @Getter(where = Where.CONSTRUCTOR, attributes = Attribute.CONSTANT, name = "$3") public static Object getGroup3(final Object self) { final RegExpResult match = Global.instance().getLastRegExpResult(); return match == null ? "" : match.getGroup(3); }