• Documentation
  • Workato Blog
  • Product Blog
  • Return to Workato
  • Login
  • Automation Institute
  • Documentation
  • Community Forums
New Topic
Discussions Recipe Building Recipe Building Questions
S

Saul Macht

started a topic over 5 years ago
Answered

How can I select only alphabets and spaces from a string?

I am currently doing some data cleaning and I would like to remove any characters in a string which are not alphabets or spaces. How can I do this? I'm stuck!


Best Answer
B
Bryan Yap said over 5 years ago

Good question! You should be able to do this using the formula .gsub(/[^a-zA-Z\s]/, "") in formula mode. 


The way the .gsub function works is that it uses the /[^a-zA-Z\s]/ regular expression to select for characters which are not alphabets or spaces with the empty string, "".


You may find some examples of how it can be used below.


Step 1: Input Data


image

Step 2: Formula to clean the String

image

Step 3: The results

image




Answer

Bryan Yap

said over 5 years ago

Good question! You should be able to do this using the formula .gsub(/[^a-zA-Z\s]/, "") in formula mode. 


The way the .gsub function works is that it uses the /[^a-zA-Z\s]/ regular expression to select for characters which are not alphabets or spaces with the empty string, "".


You may find some examples of how it can be used below.


Step 1: Input Data


image

Step 2: Formula to clean the String

image

Step 3: The results

image




Login to post a comment

Still can't find your solution?

Send us a ticket, we will try our best to assist you with your problem

Documentation
Developer's Library
Tutorials
eBooks
Product Hour
Product Blog
Workato Blog
Product updates
Customer Stories
© Workato 2022   Privacy   Terms   +1 (844) 469-6752
  • Documentation
  • Workato Blog
  • Product Blog
  • Solutions
  • Forums
  • Tickets
  • Log in
  • Return to Workato
Topic views count