Best answer

Help with a simple Text Formatter question!

  • 14 May 2024
  • 9 replies
  • 37 views

Userlevel 1
Badge

Hi, 

 

Can someone please help with where i’m going wrong extracting this text with Formatter?

 

I know it’s going to be something small!

 

username: blobby

I want to extract the term blobby

 

config for formatter i’m trying

Data out just says:

Fields with no value:
output

 

icon

Best answer by JolteonPixel 15 May 2024, 16:52

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

9 replies

Userlevel 7
Badge +14

Hi @JolteonPixel 

For us to have more context, post screenshots of the Description Text value from Step 1.

 

Userlevel 1
Badge

Hi @JolteonPixel 

For us to have more context, post screenshots of the Description Text value from Step 1.

 

 

Userlevel 7
Badge +6

Hi @JolteonPixel,

I’m jumping in to see if I can help!

I believe the Extract Pattern function is best for your use case here. You can use this regex in the “Pattern” field: username:\s*(.*)

Kindly give it a try and let me know how it goes? I'll keep an eye out for your response!

 

Userlevel 1
Badge

Hi @JolteonPixel,

I’m jumping in to see if I can help!

I believe the Extract Pattern function is best for your use case here. You can use this regex in the “Pattern” field: username:\s*(.*)

Kindly give it a try and let me know how it goes? I'll keep an eye out for your response!

 

Hi, thanks for the response!

 

Progress! I do get blobby, but then sadly I get all the text which succeeds blobby, so

 

blobby Manager: etc etc etc etc etc etc etc

Userlevel 7
Badge +14

@JolteonPixel 

Can you show the raw DATA OUT from step 1?

 

Formatter help: https://zapier.com/apps/formatter/help

Try this:

  • Action: Formatter > Text > Split
    • Split by: username:
    • Keep the last segment
  • Action: Formatter > Text > Split
    • Split by: Manager:
    • Keep the first segment
  • Action: Formatter > Text > Trim Whitespace
    • Used to remove the leading/trailing spaces

 

Other options:

  • Code for parsing text
  • AI

 

 

Userlevel 1
Badge

@JolteonPixel

Can you show the raw DATA OUT from step 1?

 

Formatter help: https://zapier.com/apps/formatter/help

Try this:

  • Action: Formatter > Text > Split
    • Split by: username:
    • Keep the last segment
  • Action: Formatter > Text > Split
    • Split by: Manager:
    • Keep the first segment
  • Action: Formatter > Text > Trim Whitespace
    • Used to remove the leading/trailing spaces

 

Other options:

  • Code for parsing text
  • AI

 

 

Thank you Troy! I never thought about doing subsequent activities on the output of a formatter step.  So I did what you said and grabbed the username, then split it and kept the first string, then removed the whitespace, so 3 actions. It would have been nice to get the regex working to make it a little more elegant, but your post got me what I wanted, thank you!

Userlevel 3
Badge +3

@JolteonPixel If you want to save action steps, you can do extraction using javascript with something like this. Replace {{data}} with your description text

 

const text = "{{data}}";
const usernameMatch = text.match(/username:\s*(\w+)/);
if (usernameMatch) {
  const username = usernameMatch[1].trim();
return username; 
}

Userlevel 7
Badge +14

@fiona819 

fyi...Formatter Zap steps count as 0 Tasks, but Code steps count as 1 Task.

Userlevel 3
Badge +3

@Troy Tessalone Thank you for your correction!