src/main/java/com/atlassian/uwc/converters/socialtext/SpaceConverter.java [49:116]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
		return converted;
	}

	Pattern linksWithSpace = Pattern.compile("" +
			"\\[" +
			"([^:\\]]+)");
	/**
	 * transforms workspaces in link syntax to confluence spacekeys
	 * @param input page text
	 * @param spaces mapping of workspaces to spacekeys
	 * @return
	 */
	protected String convertSpaceInLinks(String input, HashMap spaces) {
		Matcher spaceFinder = linksWithSpace.matcher(input);
		return convertSpaces(input, spaces, spaceFinder, "[");
	}

	/**
	 * transforms workspaces in a given syntax (represented by the regex Matcher) to
	 * confluence spacekeys
	 * @param input page text
	 * @param spaces workspace to spacekey mapping
	 * @param finder represents the regex syntax to identify the workspace. The associated pattern
	 * must have at least one group which captures the socialtext workspace. It must not capture 
	 * anything after the workspace.
	 * @param The replacement text for what comes before group 1 in the regex.
	 * @return transformed text
	 */
	private String convertSpaces(String input, HashMap spaces, Matcher finder, String delim) {
		StringBuffer sb = new StringBuffer();
		boolean found = false;
		while (finder.find()) {
			found = true;
			String rawSpace = finder.group(1);
			log.debug("rawSpace = " + rawSpace);
			String space = rawSpace;
			String alias = "";
			if (rawSpace.contains("|")) {
				String[] parts = rawSpace.split("\\|");
				alias = parts[0] + "|";
				space = parts[1];
			}
			if (!spaces.containsKey(space)) continue;
			String newspace = (String) spaces.get(space);
			log.debug("newspace = " + newspace);
			String replacement = delim + alias + newspace;
			replacement = RegexUtil.handleEscapesInReplacement(replacement);
			finder.appendReplacement(sb, replacement);
		}
		if (found) {
			finder.appendTail(sb);
			return sb.toString();
		}
		return input;
	}

	Pattern imagesWithSpace = Pattern.compile("" +
			"[!]" +
			"([^:!\\]]+)");
	/**
	 * transforms workspaces in image syntax to confluence spacekeys
	 * @param input page text
	 * @param spaces mapping of workspaces to spacekeys
	 * @return
	 */
	protected String convertSpaceInImages(String input, HashMap spaces) {
		Matcher spaceFinder = imagesWithSpace.matcher(input);
		return convertSpaces(input, spaces, spaceFinder, "!");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



src/main/java/com/atlassian/uwc/converters/twiki/SpaceConverter.java [41:108]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
		return converted;
	}

	Pattern linksWithSpace = Pattern.compile("" +
			"\\[" +
			"([^:\\]]+)");
	/**
	 * transforms webs in link syntax to confluence spacekeys
	 * @param input page text
	 * @param spaces mapping of webs to spacekeys
	 * @return
	 */
	protected String convertSpaceInLinks(String input, HashMap spaces) {
		Matcher spaceFinder = linksWithSpace.matcher(input);
		return convertSpaces(input, spaces, spaceFinder, "[");
	}

	/**
	 * transforms webs in a given syntax (represented by the regex Matcher) to
	 * confluence spacekeys
	 * @param input page text
	 * @param spaces web to spacekey mapping
	 * @param finder represents the regex syntax to identify the web. The associated pattern
	 * must have at least one group which captures the twiki web. It must not capture 
	 * anything after the web.
	 * @param The replacement text for what comes before group 1 in the regex.
	 * @return transformed text
	 */
	private String convertSpaces(String input, HashMap spaces, Matcher finder, String delim) {
		StringBuffer sb = new StringBuffer();
		boolean found = false;
		while (finder.find()) {
			found = true;
			String rawSpace = finder.group(1);
			log.debug("rawSpace = " + rawSpace);
			String space = rawSpace;
			String alias = "";
			if (rawSpace.contains("|")) {
				String[] parts = rawSpace.split("\\|");
				alias = parts[0] + "|";
				space = parts[1];
			}
			if (!spaces.containsKey(space)) continue;
			String newspace = (String) spaces.get(space);
			log.debug("newspace = " + newspace);
			String replacement = delim + alias + newspace;
			replacement = RegexUtil.handleEscapesInReplacement(replacement);
			finder.appendReplacement(sb, replacement);
		}
		if (found) {
			finder.appendTail(sb);
			return sb.toString();
		}
		return input;
	}

	Pattern imagesWithSpace = Pattern.compile("" +
			"[!]" +
			"([^:!\\]]+)");
	/**
	 * transforms webs in image syntax to confluence spacekeys
	 * @param input page text
	 * @param spaces mapping of webs to spacekeys
	 * @return
	 */
	protected String convertSpaceInImages(String input, HashMap spaces) {
		Matcher spaceFinder = imagesWithSpace.matcher(input);
		return convertSpaces(input, spaces, spaceFinder, "!");
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



