This works fine, but may not be the way regexp was designed to be used. I would appreciate any comments that can direct me to better ways to do this.
This is the guts of pseudocode for a tag substitution program that goes through files, finds all the tags, and does the right thing with the tags portion, while just passing the rest through unchanged. int startPrint = 0; int tagStart = 0; int tagEnd = 0; aString = "a string of some long sort, mostly miles of text from files"; RE reg = new RE("aTagMatch"); for(int i = 0;reg.match(aString,tagEnd+1);i++){ startPrint=tagEnd; tagStart=reg.getParenStart(0); tagEnd=reg.getParenEnd(0); System.out.println(aString.substring(startPrint,tagStart)); System.out.println(i+ " startPrint = " + startPrint + " tagStart = " + tagStart+ " tagEnd = " + tagEnd + " Test String was '" + reg.getParen(0) + "'"); } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>