OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Split with regex and group not working


Hi

Yeah you can also provide a sample project / sample code / unit test
that demonstrates this issue.
That can help track down and fix the problem. And also log a JIRA
ticket so its not forgotten.

On Tue, Jun 19, 2018 at 10:20 PM, Alex Dettinger <aldettinger@xxxxxxxxx> wrote:
> Hi Rory,
>
>   If I get it well the whole regex is inserted between lines while you were
> expecting to insert only the matching part of the regex.
> In that case, you are welcome to work on a fix or open a ticket.
>
>   At Apache Camel, we love contributions ;)
> https://github.com/apache/camel/blob/master/CONTRIBUTING.md
>
> Many thanks,
> Alex
>
> On Tue, Jun 19, 2018 at 1:24 PM, Rory Gilfillan <rory.gilfillan@xxxxxxxxx>
> wrote:
>
>> The following code doesn't work:
>>
>>            .split().tokenize("\n|\r\n", true, 100, true)
>>
>>
>> It tries to reinsert the token between the lines without taking into
>> account that the token is a regex string.
>>
>>
>> The follow code in the GroupTokenIterator is the culprit:
>>
>>             // include token in between
>>             if (data != null && count > 0 && token != null) {
>>                 bos.write(token.getBytes());
>>             }
>>
>>
>> The contents of this email and any attachments are confidential, may be
>> privileged and may only be read and used by the named recipient(s). If you
>> have received it in error please contact the sender immediately and delete
>> the e-mail. We endeavour to exclude viruses from our emails, but it is your
>> responsibility to check this email for viruses. ITQ Business Solutions
>> (Pty) Ltd accepts no liability or responsibility of whatsoever nature for
>> any failure or loss arising in any way from the use of email as a means of
>> communication.
>>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2