|
Rank: Member
Joined: 5/26/2015 Posts: 10 Location: United Kingdom
|
Hi,
I'm trying to use a regular expression in my flextext file to split a value after the 3rd pipe ( | )
I am using the split once function but can't get it to function as i need:
example
input file value1|value2|value3|value4|value5|value6|value7
Expected first output value1|value2|value3
Second Output value4|value5|value6|value7
Any help appreciated
|
|
Rank: Newbie
Joined: 10/28/2002 Posts: 1,283 Location: AT
|
Hi,
try this:
|
|
Rank: Member
Joined: 5/26/2015 Posts: 10 Location: United Kingdom
|
Hi Island,
Thanks for the suggestion, however Mapforce doesn't keep the start of the string.
You can see in the second screenshot the sample text of "Store" is blank
Regards
Graham
|
|
Rank: Newbie
Joined: 10/28/2002 Posts: 1,283 Location: AT
|
Yes you are right.
At the moment I am unsure what the correct regular expression would be to match only the 3rd occurrence of the pipe character in the string, but in the absence of a regular expression you could always split the line three times and store the value each time (see attached flextext).
File Attachment(s): MapForceFlexText1.zip (1kb) downloaded 647 time(s).
|
|
Rank: Member
Joined: 5/26/2015 Posts: 10 Location: United Kingdom
|
Thanks, this works but its a shame its not as clean as the regular expression option.
|
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
The regular expression syntax simply doesn't allow to count occurrence, therefore it doesn't work. The attempt with ([^/|]*[/|]){3} doesn't work either because it declares the whole start of the string as a one big splitter, which is why it "gets lost" - what you get is everything before (empty string) and everything after.
|
|
Rank: Member
Joined: 5/26/2015 Posts: 10 Location: United Kingdom
|
Perhaps a possible improvement for future release would be an option to store the splitter value too.
|
|
guest |