BusinessObjects Board

how to extract part of a string from the middle

Hello,

I am using BO4.

I have a string object “Order Details” which gives me an output of different lengths that looks like this:

{device:Apple iPad 2019 128GB Silver,tariff:30 days, 100 texts, 100GB data,bolt_ons:[{name:T2 Open 25 percent Airtime Discount}],referred:Accept}

I need to write two different variables and each should give me extract from the above string as shown below.

1st Variable: this is always followed by the word “tariff:” in the string.
Desired output: 30 days, 100 texts, 100GB

2nd Variable: followed by “bolt_ons:[{name:” in the string
Desired output: T2 Open 25 percent Airtime Discount

Can I get some help how this can be achieved please?


Karachiite (BOB member since 2013-04-12)

you can use a combination of substr() and pos() and match() to find your text.

if special characters are a problem, they can be replaced with replace()
e.g. in Problem with Match() and escape character


n8aktiv :de: (BOB member since 2018-12-29)

That’s great, thank you very much.


Karachiite (BOB member since 2013-04-12)