PAL - How to pick up the text between the brackets []

Infosphere's Quality Product

Moderators: chulett, rschirm

Post Reply
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

need more info...

Is it possible to have nested mixed punctuation like blah (other] blah [oops) or do they all match a simple pattern? Can they end with {[( ? or the like?

You should be able to make a single rule that says anything followed by one character in the list of {{( followed by (anything? a pattern? what makes sense here) and ends in one character from the list of ]})

That may not be sufficient for all cases or may even fail on some cases depending on the actual data patterns.

Then you need to replace {{( with [ and the same for ] maybe ?? or extract from there the portion you wanted?

The real catch is just whether the simple rule is sufficient for your data.


--- Some tasks may or may not make sense to do other ways. If I wanted the data in between two brackets, I would pull it out in a transformer.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try the pattern \[**\]$
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
igorbmartins
Participant
Posts: 161
Joined: Mon Mar 17, 2008 10:33 am

Post by igorbmartins »

Hello, on the weekend I didiscovered how to do it in a single rule.

*& | & ="[", "(", "{" | ** | & ="]",")","}" | $ ;LIGACLIP CLIP TIT M BRANCO[200]
COPY [3] {CodigoRef}
RETYPE [2] 0
RETYPE [3] 0
RETYPE [4] 0

Thank you guys.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Thank you for posting complete solution.

Note that yours will pick up **[text) for example (mismatched brackets).

But if you are 100% sure that the brackets will always be matched, then your solution will suffice. Otherwise you need a pattern with OR operators.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
igorbmartins
Participant
Posts: 161
Joined: Mon Mar 17, 2008 10:33 am

Post by igorbmartins »

Hello Ray, because of that I decided to use this rule. In my data base there are rows with:

bla bla [0001]
bla bla {0002}
bla bla (0003)
bla bla [0004}
bla bla [0005)
bla bla {0006)

Thanks,
Igor Bastos Martins
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Given that such is the case, your rule is the perfect choice.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply