I am trying to extract the 1st and 4th word but it just keeps grabbing the first 4 words, I've tried without the ^ and it doesn't work
RegEx show you the match string. The string to extract in brackets return by the list "Subexpression Matches List Name" (Transformer Stringsearcher).
Use a StringSearcher. Let your regex find all words. Write all matches to a list. Item 0 of the list contains the first match (you can also write the first match to an attribute in the StringSearcher), item 3 of the list contains the fourth match.
Use a StringSearcher. Let your regex find all words. Write all matches to a list. Item 0 of the list contains the first match (you can also write the first match to an attribute in the StringSearcher), item 3 of the list contains the fourth match.
If using the StringSearcher, you can use the Subexpression Matches List Name and that will return just the 1st and 4th words as two list items(the items within the brackets in the regex)
Use a StringSearcher. Let your regex find all words. Write all matches to a list. Item 0 of the list contains the first match (you can also write the first match to an attribute in the StringSearcher), item 3 of the list contains the fourth match.
Which would look like this:
Thanks, I never knew this
Which would look like this:
Thanks, I never knew this
I'm writing this in the first answer ...
@williamlin98 Attach is a workspace which I hope provides you with another alternative solution. As others have suggested, you will still need to create a list. It seems to me that the value of your attribute is separated by hyphen. If that is the case then splitting your attribute value works out better.
You can also extract the first and fourth words within an AttributeCreator/AttributeManager using the StringFunction @SubstringRegularExpression. The 1 and 2 in these expressions refer to the 1st and 2nd match groups
Thanks for the answers everyone, helped heaps <3