Intro
You can pull a segment of text from a text string using either a MySQL or Magic ETL DataFlow (similar to using SUBSTRING in Beast Mode).SUBSTRING in a MySQL DataFlow
You can use SUBSTRING_INDEX() in a MySQL DataFlow to pull a segment of text from a string of text. For example, you might want to pull the number and name from {“number”:“91402”,“name”:“Frodo”}. Use SUBSTRING_INDEX(str,delim,count ) to return the substring str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. SUBSTRING_INDEX() performs a case-sensitive match when searching for delim.mysql> SELECT SUBSTRING_INDEX(' www.mysql.com ', '.', 2); -> 'www.mysql' mysql> SELECT SUBSTRING_INDEX(' www.mysql.com ', '.', -2); -> ' mysql.com '
Using our example…
,substring_index(substring_index(`data`, '"', 4),'"',-1) as 'number'
,substring_index(substring_index(`data`, '"', 8),'"',-1) as 'name'