Package org.jregex

Examples of org.jregex.MatchResult.groupCount()


                            index = ix;
                        }
                    }
                    MatchResult mr = getMatchResult(on);
                    if(index < mr.groupCount() && mr.isCaptured(index)) {
                        return context.runtime.newNumber(mr.start(index));
                    } else {
                        return context.runtime.newNumber(-1);
                    }
                }
View Full Code Here


                            index = ix;
                        }
                    }
                    MatchResult mr = getMatchResult(on);
                    if(index < mr.groupCount() && mr.isCaptured(index)) {
                        return context.runtime.newNumber(mr.end(index));
                    } else {
                        return context.runtime.newNumber(-1);
                    }
                }
View Full Code Here

                            index = ix;
                        }
                    }
                    MatchResult mr = getMatchResult(on);
                    if(index < mr.groupCount() && mr.isCaptured(index)) {
                        return context.runtime.newPair(context.runtime.newNumber(mr.start(index)), context.runtime.newNumber(mr.end(index)));
                    } else {
                        return context.runtime.nil;
                    }
                }
View Full Code Here

                        if(ix == null || !mr.isCaptured(ix)) {
                            return context.runtime.nil;
                        }
                        return context.runtime.newText(mr.group(ix));
                    } else {
                        int size = mr.groupCount();

                        if(IokeObject.data(arg) instanceof Range) {
                            int first = Number.extractInt(Range.getFrom(arg), message, context);

                            if(first < 0) {
View Full Code Here

        obj.registerMethod(runtime.newNativeMethod("returns a list of all groups captured in this match. if a group is not matched it will be nil in the list. the actual match text is not included in this list.", new TypeCheckingNativeMethod.WithNoArguments("captures", obj) {
                @Override
                public Object activate(IokeObject method, Object on, List<Object> args, Map<String, Object> keywords, IokeObject context, IokeObject message) throws ControlFlow {
                    List<Object> groups = new ArrayList<Object>();
                    MatchResult mr = getMatchResult(on);
                    int len = mr.groupCount();
                    for(int i=1;i<len;i++) {
                        if(mr.isCaptured(i)) {
                            groups.add(context.runtime.newText(mr.group(i)));
                        } else {
                            groups.add(context.runtime.nil);
View Full Code Here

        obj.registerMethod(runtime.newNativeMethod("returns a list of all groups captured in this match. if a group is not matched it will be nil in the list. the actual match text is the first element in the list.", new TypeCheckingNativeMethod.WithNoArguments("asList", obj) {
                @Override
                public Object activate(IokeObject method, Object on, List<Object> args, Map<String, Object> keywords, IokeObject context, IokeObject message) throws ControlFlow {
                    List<Object> groups = new ArrayList<Object>();
                    MatchResult mr = getMatchResult(on);
                    int len = mr.groupCount();
                    for(int i=0;i<len;i++) {
                        if(mr.isCaptured(i)) {
                            groups.add(context.runtime.newText(mr.group(i)));
                        } else {
                            groups.add(context.runtime.nil);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.