end() public method

public end ( ) : int
return int
Esempio n. 1
0
		internal static void ReplaceMatch (string replacementPattern, Matcher match, StringBuffer sb, string input, PatternData patternData) {

			replacementPattern = JavaUtils.ReplaceAll (replacementPattern, COPY_ENTIRE_MATCH_PATTERN, match.group ());
			replacementPattern = JavaUtils.ReplaceAll (replacementPattern, INPUT_BEFORE_MATCH_PATTERN, input.Substring (0, match.start ()));
			replacementPattern = JavaUtils.ReplaceAll (replacementPattern, INPUT_AFTER_MATCH_PATTERN, input.Substring (match.end ()));
			replacementPattern = JavaUtils.ReplaceAll (replacementPattern, INPUT_PATTERN, input);

			int groupsNumber = match.groupCount ();
			if (groupsNumber > 0) {
				Pattern p = Pattern.compile (LAST_CAPTURED_GROUP_PATTERN);
				Matcher m = p.matcher ((CharSequence) (object) replacementPattern);
				if (m.find ()) {
					while (groupsNumber > 0) {
						if (match.start (patternData.NetToJavaNumbersMap [groupsNumber]) >= 0) {
							break;
						}
						--groupsNumber;
					}
					if (groupsNumber > 0) {
						replacementPattern = m.replaceAll (match.group (patternData.NetToJavaNumbersMap [groupsNumber]));
					}
				}
			}

			match.appendReplacement (sb, replacementPattern);
		}
Esempio n. 2
0
		private void AddGroup (Matcher m, GroupCollection groups, int javaGroupNumber, string text, Match match) {
			int netGroupNumber = _patternData.JavaToNetGroupNumbersMap [javaGroupNumber];
			if (netGroupNumber == -1) {
				return;
			}

			int index = m.start (javaGroupNumber);

			if (index < 0){
				if(groups[netGroupNumber] == null) 
					groups.SetValue (new Group (), netGroupNumber);
				return;
			}

			Group group = new Group (text, index, m.end (javaGroupNumber) - index, match, netGroupNumber);

			groups.SetValue (group, netGroupNumber);
		}