You are here

Help with index_start.scrub - date and time separate data

6 posts / 0 new
Last post
usr
Offline
Joined: 6 years
Last seen: 5 years
Help with index_start.scrub - date and time separate data

I have everything working except for index_start.scrub in a new ini I am writing.

I am not sure how to get both blocks (date and time) to capture and parse it into one string, which will be used for index_start

Here is the block that index_start is matching ( there is more string data before and after the sample, but this is just the important part).

"TX_DATE":"2018-04-27","START_TIME":"23:30","PROGRAMME_TITLE:"

Currently I only have the START_TIME capturing correctly and not the TX_DATE or together. This is what I have so far:

index_start.scrub {multi(debug)|"START_TIME":"||","|}

If someone could please lend me a hand in getting this to work, that would be appreciated :)

usr
Offline
Joined: 6 years
Last seen: 5 years

Thanks for the help.

tonyadams
Offline
Joined: 1 year
Last seen: 1 year
usr wrote:

I have everything working except for index_start.scrub in a new ini I am writing.
I am not sure how to get both blocks (date and time) to capture and parse it into one string, which will be used for index_start
Here is the block that index_start is matching ( there is more string data before and after the sample, but this is just the important part).
"TX_DATE":"2018-04-27","START_TIME":"23:30","PROGRAMME_TITLE:io games"
Currently I only have the START_TIME capturing correctly and not the TX_DATE or together. This is what I have so far:
index_start.scrub {multi(debug)|"START_TIME":"||","|}
If someone could please lend me a hand in getting this to work, that would be appreciated :)

To capture both the TX_DATE and START_TIME from the string and combine them into one string for index_start, you can modify the scrub expression as follows:
index_start.scrub {multi(debug)|"TX_DATE":"(\d{4}-\d{2}-\d{2})","START_TIME":"(\d{2}:\d{2})"|"$1 $2"}
Hope this will help.

japangelo
Offline
japangelo's picture
Donator
Joined: 4 years
Last seen: 4 hours
japangelo
Offline
japangelo's picture
Donator
Joined: 4 years
Last seen: 4 hours

The post is 5 years old I think it's a bit late lol
But it wouldn't work.. You either use separators or regex.. And this regex expression doesn't look right

Blackbear199
Online
Blackbear199's picture
WG++ Team memberDonator
Joined: 9 years
Last seen: 1 min

expanding on what japangelo said,your mixing separator string and regex method's which wont work.
we cannot use $1 $2 with webgrab regex so you have to do it like this..

index_start.scrub {regex||"TX_DATE":"(\d{4}-\d{2}-\d{2}","START_TIME":"\d{2}:\d{2})"||}
index_start.modify {replace|","START_TIME":"| }

webgrab regex uses || for delimeters for .scrub and " for .modify
index_start.modify {replace(type=regex)|"\",\"START_TIME\":\""| }

finally a another way to do it.
index_start.scrub {single|"START_TIME":"||"|"}
index_temp_1.scrub {single|"TX_DATE":"||"|"}
index_start.modify {addstart|'index_temp_1' }

above uses separator string method,you could also uses regex.

Log in or register to post comments

Brought to you by Jan van Straaten

Program Development - Jan van Straaten ------- Web design - Francis De Paemeleere
Supported by: servercare.nl