Parse customer name

Hi.

I need to parse the customer name, but there are cases when the customer name has one, two or even three words.

Example 1: Customer name with 3 words

INFO 2019-10-15 16:34:41,964 transaction.TransactionDocumentPersisterImpl - Transaction chassisCheckPlusRedbook bda19842 | id: 1938978 timestamp: 2019-10-15T16:34:41.000+13:00 user: Luke test name (13756439) request address: 8.8.8.8 login id: 193897

Example 2: Customer name with 2 words

INFO 2019-10-15 16:34:41,964 transaction.TransactionDocumentPersisterImpl - Transaction chassisCheckPlusRedbook bda19842 | id: 1938978 timestamp: 2019-10-15T16:34:41.000+13:00 user: Luke test (13756439) request address: 8.8.8.8 login id: 193897

Using the option NOTSPACE works.. but only for the times specified.

timestamp: %{TIMESTAMP_ISO8601:timestamp} user: %{NOTSPACE:customer} %{NOTSPACE:customer} %{NOTSPACE:customer} \(%{NUMBER:customer-id:int}\)

The above string will only work when the customer name has 3 words.

How can I have something smart enough that, everything between user: and \(%{NUMBER:customer-id:int}\) is the customer name?

You could use

(?<customer>[a-zA-Z ]+)
1 Like

That works! Thank you

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.