01-14-2020 04:54 AM
Hi,
I need some help on spliting the user name on basis of Regex expression.My user Name is an combination of mutliple users and i cant use comma to split them. so, i tried regular expression and which is working good on DB level and planned to implement same in Snaplogic, but it is not working. Please some one can help me here.
01-14-2020 06:44 PM
Are you able to share an example name, or confirm if something like JohnBobSarahBill is a good example? If so, and if this could be any combination of names, what are you able to split on? Is each name always the same length?
01-14-2020 09:24 PM
Hi,
The best example is below, it have three names separated by comma, so I thought of using some logic as
“regexp_substr(dossier_lead, ‘[[:alnum:] .()-]+, [[:alnum:] .()-]+’,1, level,‘i’)” it is working in oracle but it is hanging, so i thought of trying same logic in snaplogic.
Example: john, maria,lisa, awari,Arun, john(TCS)
01-15-2020 07:27 AM
Thank you for the additional information. I believe there was a typo in the initial post indicating that you could not use commas. If your JSON was something like “names” : “john, maria,lisa, awari,Arun, john(TCS)” you could use the expression $names.split(‘,’) which will result in a “names” array. If you want to remove the white space you could use $names.replaceAll(’ ‘,’‘).split(’,').
Screenshot of split only:
Screenshot of expression with replaceAll and split:
01-16-2020 12:28 AM
Hi,
I tried above solution, but i am getting output as below
.
but the excepted output will be combination of first name and last name (john, maria).
Any advice. Thanks