Informatica supports PERL like regex syntax. So any parsing you would do in shell, can be done in Informatica as well.
In the code above, __ are the delimiters in the string.
The regext part
\w looks for any alphanumeric character including underscore. Adding + to it makes it look for multiple alphanum characters.
() are to group the patterns
. looks for any character and adding & * makes it look for all the occurrences of any characters.
So we have four groups and the output is the 3rd group.
OUTPUT
Can you figure the other groups? Now can you figure how many groups we need if we just need the number of books in series or just the genre?
REG_EXTRACT('Fiction__JK_ROWLING__HARRY_POTTER__MAX07','(\w+)(__\w+__)(\w+)(__.*)',3)
In the code above, __ are the delimiters in the string.
The regext part
\w looks for any alphanumeric character including underscore. Adding + to it makes it look for multiple alphanum characters.
() are to group the patterns
. looks for any character and adding & * makes it look for all the occurrences of any characters.
So we have four groups and the output is the 3rd group.
OUTPUT
HARRY_POTTER
Can you figure the other groups? Now can you figure how many groups we need if we just need the number of books in series or just the genre?
No comments:
Post a Comment