Hi Shawn,

Solrj’s StrUtils.splitSmart() should do exactly what you want - in the first 
pass, split on semicolon and don’t decode backslash escaping, and then in the 
inner loop, use the same method to split on colons and decode backslash 
escaping.  I think :).

Steve
 
On Jan 14, 2014, at 10:07 AM, Shawn Heisey <s...@elyograg.org> wrote:

> I have a Java question, for a custom update processor I'm developing. It
> takes an input field of the following format:
> 
> field:value;mvfield:value1;mvfield:value2
> 
> With an inner delimiter set to a colon and an outer delimiter set to a
> semicolon, this results in two new fields going into the document. The
> field named 'field' has one value and the field named mvfield has two.
> 
> This code uses the String#split method,  so it can't deal with the
> delimiter characters being escaped with a backslash.
> 
> How can I make the code deal with an escape character (backslash) on the
> two delimiters and the escape character itself? Unless it's absolutely
> necessary or super easy, I do not plan to deal with the full set of regex
> escaped characters.
> 
> I can move this discussion to the development list, but I thought I would
> start here.
> 
> Thanks,
> Shawn
> 
> 

Reply via email to