Hi Team,
I need to extract string from a string, can you please guide me
e.g. Full Name ( ALIAS ) --> ALIAS (string which is in square brackets)
if string is David King ( DAVIDK ) i need DavidK
Stewart Mark ( STMARK ) i need STMARK
Thanks
Hi,
You need to do something like this
SyntaxEditor Code Snippet
Trim(Substr(Var1,Index(Var1,"(")+1,Index(Var1,")")-Index(Var1,"(")-1))
Keep in mind this isn't protected against cases where there are no brackets on var1. you need to do those checks before.
Regards,
Marcelo
Marcelo Ferreira wrote:
Thanks.. Its working
Another option is using the Regex_Search from Text extension.
This will return the string with brackets. You only need to remove them.
Substr(Regex_Search.PatternResult,1,Length(Regex_Search.PatternResult)-2)
To return the string without brackets, you can use:
(?<=\(\s)(.*)(?=\s\))
Find and exclude "( ", find and include "ALIAS", and find and exclude " )"