Support Questions

Find answers, ask questions, and share your expertise

Extract Text - Extracting delimited data

avatar
Contributor

Hello All,

I am trying to extract data using ExtractText such that

Original Text = T03%%350%%11502998%%2151%%3312,56%%3

String.1 = T03

String.2 = 11502998

How can I do that using ExtractText?

Also, can someone please guide me to good resources ( website, blog etc.) so that I can parse such trivial strings by myself in future? 🙂

1 ACCEPTED SOLUTION

avatar
Master Mentor
@M R

I find the following very useful when trying to build Java regular expressions:

http://myregexp.com

The Java regular expression:

^(.*?)%%(.*?)%%(.*?)%%(.*?)%%(.*?),(.*?)%%(.*?)$

It has 7 capture groups that will result in:

19414-screen-shot-2017-07-12-at-31348-pm.png

When you add a ew property to the extractText processor with a property name of "string" and use the above java regex.

Of course if you are only looking for two capture groups, you could use the following regex instead:

^(.*?)%%.*?%%(.*?)%%.*?%%.*?,.*?%%.*?$

Thanks,

Matt

View solution in original post

2 REPLIES 2

avatar
Master Mentor
@M R

I find the following very useful when trying to build Java regular expressions:

http://myregexp.com

The Java regular expression:

^(.*?)%%(.*?)%%(.*?)%%(.*?)%%(.*?),(.*?)%%(.*?)$

It has 7 capture groups that will result in:

19414-screen-shot-2017-07-12-at-31348-pm.png

When you add a ew property to the extractText processor with a property name of "string" and use the above java regex.

Of course if you are only looking for two capture groups, you could use the following regex instead:

^(.*?)%%.*?%%(.*?)%%.*?%%.*?,.*?%%.*?$

Thanks,

Matt

avatar
Contributor

Thanks Matt. 🙂