Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: awilliams1024To match a word with a regular expression you will need to ensure your pattern includes the 'anchor' for the beginning of a word or the end of a word \\b
So, to match the word "one" your pattern would need to be "\\bone\\b"
To match multiple words you can use alternation or you can construct a pattern that includes each word separated by the regular expression OR operator |
The attached data flow shows how you can join your list of words into a delimited string so they can be used in the matching process. It then goes on to provide some use cases:
1. a use case of using alternation to match multiple words (in the top Filter node on the right hand side). The output simply provides a Boolean field that indicates whether any of the words in the word list were matched in the input data.
2. a use case that extends the above to also provide a delimited list of the words that were matched in each record (middle Filter node).
3. a use case that further extends the above to replace each of the matched words with a single delimiter character (in this case "�"). The results string is then split into multiple columns using the 'Split Field by Delimiters' node (bottom Filter node etc).
You may also want to review this thread which discusses some alternative ways of splitting a string into multiple columns:
http://community.lavastorm.com/threa...-Columns-ouput
Depending on your ultimate objective, you may want to consider whether it is absolutely necessary to split the data into multiple columns to achieve your aim. This is an 'expensive' operation to perform and you may end up with a lot of columns with a significant number of NULL values.
Regex_Match_Multiple_Words.brg
Regards,
Adrian