You have to determine what your “word” delimiter is if you want do to something like matching a whole word.
One method would be to split on spaces, and then require an exact match on the given word
Q: substrings separated by " " whose (it="abc123") of "abc123 def456 ghi789"
A: abc123
Depending on the use-case, complexity of match, and data size, you might also use Regular Expressions, which can match as simple or as complex as you like…
Q: matches(regex("abc123")) of "abc123 def456 ghi789"
A: abc123
Q: matches(regex("abc\d+")) of "abc123 def456 ghi789"
A: abc123
Q: matches(regex("abc[^\s]+")) of "abc123 def456 ghi789"
A: abc123
Q: parenthesized parts 2 of matches(regex("(^|\s)(abc[^\s]+)")) of "abc123 def456 ghi789"
A: abc123