Hi, I have a field called "Employee_Email". This field contains the value:
["firstname.lastname@gmail.com"]
How do I remove the special characters [" and "]?
I tried:
| eval test1 = replace (Employee_Email "[" , "")
But when I tried to remove either [ or " it gives me the following errors:
Error in 'EvalCommand': Regex: missing terminating ] for character class
Or:
Unbalanced quotes.
Is there a way to ignore the normal effect of [ and "?
You need to escape the square brackets and double quotes
| eval test1=replace(replace(Employee_Email,"\[\"",""),"\"\]","")
You need to escape the square brackets and double quotes
| eval test1=replace(replace(Employee_Email,"\[\"",""),"\"\]","")
Tried this and it worked thanks
As an alternative you can use other functions
| eval trimmed_email=trim(Employee_Email,"\"[]")
or
| eval substr_email=substr(Employee_Email,3,len(Employee_Email)-4)
This is indeed a nice alternative thank you!
Edit:
I tried:
| eval test1 = replace (Employee_Email, "[" , "")