Use the StringSearcher Transformer and match the first 19 characters with:
^.{19}
or to match just the first space in the string use:
^[^\\s]*\\K\\s
...though that won't exactly count 19 before it matches the space, it just matches the first space in the string.
Hope that helps
So Good job your answer below.
I would use two steps:
Use a SubstringExtractor transformer to find the part after character 19 (start 19 end -1).
Then do the StringSearcher (looking for the first space in the substring). If you add 19 to the _index you will have the location of the first space after position 19 in the original attribute.
Hi @gmbutler2
one more approach would be to:
- find all spaces in the source string using StringSearcher (the 'found spaces' together with their positions in the source string will be stored in as a list where each item has two elements: match and startIndex);
- find list item with startIndex > 19 using List Searcher and save it as an attribute using ListIndexer;
- create two new attributes - one with the beginning of the string till the space found after 19th position of the string and another with the rest of the string:
- _firstPart = @Left(@Value(_address),@Value(startIndex))
- _secondPart = @Substring(@Value(_address),@Value(startIndex)+1,-1)
Please take a look at the attached workspace.
This solution is not as elegant as what was suggested before, but if you are not a regex fan you might like it :)