You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oro-user@jakarta.apache.org by "Terence P. Quigley" <tq...@emprisetech.com> on 2002/02/20 23:24:24 UTC

Question about parsing hex data

I can't seem to get pattern matching to work using the following pattern
and code under ORO 2.0.4

private final String messageRegExp = "(<SOM.*?>[\\x00-\\xff]*?<EOM>)";

messagePattern = getCompiler().compile(messageRegExp);

public TcpMessageFinderResult extractTcpMessage(String buffer)
{
	//System.out.println("TCP message is: " + buffer);
	
	Perl5Matcher matcher = new Perl5Matcher();
	PatternMatcherInput input = new PatternMatcherInput(buffer);
	TcpMessageFinderResult result = new TcpMessageFinderResult();
	ArrayList arr = result.getMessages();
	String postMatch = null;
	//matcher.setMultiline(false);
	while (matcher.contains(input, getMessagePattern()))
	{
		result.setContains(true);
		MatchResult matchResult = matcher.getMatch();
		if (matchResult.groups() >= 1)
			arr.add(matchResult.group(1));
		postMatch = input.postMatch();
	}
	result.setPostMatch(postMatch);
	return result;
}


The data bounded by <SOM> and <EOM> tags parses fine when the embedded
data is plain text.  
However, when that same data is encrypted (still in ASCII format) the
expression fails to match.  I've 
tried numerous expressions in an attempt to get this working, but with
no luck.  Any help would be greatly
appreciated.


Thanks,
Terry Quigley

P.S. I've enclosed the encrypted data in case that helps. 




 <<oro.txt>>  <<orolog.txt>>