Fix checking for looped matching (needs to check against new match end, not previous match end); Add attribute key for java string