summaryrefslogtreecommitdiffstats
path: root/parsers/DocumentDate.java
blob: 717fe252cf89506c5b083cccbb0a9d68c6c94e62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package scruf.parsers;

import java.util.regex.*;

public class DocumentDate implements Parser {
	public String parse(String fileContent) {
		String timeTag = "<div class=\"time\"> $2 </div> \n";
		StringBuffer sbuffer = new StringBuffer();
		Pattern pattern = Pattern.compile("(\\$\\$\\$)(.+?)(\\1)");
		Matcher matcher = pattern.matcher(fileContent);
		while(matcher.find()) {
			matcher.appendReplacement(sbuffer,timeTag);
		}
		matcher.appendTail(sbuffer);
		return sbuffer.toString();
	}
}