Phoenix, AZ

Welcome to the Phoenix, AZ User Group! Please join us in sharing experiences and knowledge. Phoenix User Group Leaders
Welcome & Guidelines

Find tips to make the most of your User Group experience.

LEARN MORE
The Expert Exam is now live online! Read about the specifics and what it took to bring it to life in the blog by our very own Elizabeth Bonnell!
Reply
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.
Highlighted

String function - "|" not working in string functions

7 - Meteor

String function - "|" not working in string functions.

 

I need to replace "|'" with spaces on a strung. I am not able to use any string functions with '|'. '|' always defaults to '\'.

 

 

9 REPLIES 9
Alteryx Partner
Alteryx Partner
Look into two things. Replace and Regex_replace. Both of those should take care of your problem. You seem to have a lot of regex problems. Check out Regex101.com its THE BEST tool to practice regular expressions
Treyson Marks
Senior Analytics Engineer
PK Global
Highlighted
8 - Asteroid

Are you using RegEx to do this? 

 

It works for me if I just do a simple Replace([Field1], '|', ' ')

 

If you are using RegEx it will not work because '|' means something to RegEx; it's a special character which means 'or'. So if you are entering REGEX_Replace([Field1], '|', ' ') you are giving it a nonsensical instruction. To make RegEx recognize '|' as a non-special character you must use the escape character ('\') in front of it; REGEX_Replace([Field1], '\|', ' ')

 

I hope this makes sense and works for you 🙂

Highlighted
7 - Meteor

When I use Replace it changed to Replace([Chargeline],'/','  ') instead of Replace([Chargeline],'|',' ')

Highlighted
Alteryx Partner
Hi George. The | is typically Shift+/ in a standard keyboard. Could that be the issue?
Highlighted
8 - Asteroid

Hello George,

 

I have attached a test workflow for you to look at. I hope that it helps. If the simple Replace() is not working, then I would go with REGEX_Replace()

 

If neither of those things work for you I am out of ideas i'm afraid 😞

Highlighted
Alteryx Partner
Alteryx Partner

Hey @Georgealex,

 

I want to respond to this comment

 

Comment.png

 

I think that when you look at the formula it only appears to have a forward slash(?) because of the italicizing that Alteryx does. If you look at @G1's example, you can see that his notations under the tool show the pipe (|), but it looks like /

 

Italicized.png

Treyson Marks
Senior Analytics Engineer
PK Global
Highlighted
8 - Asteroid

Agreed. Except for the 'his' bit. I am a 'her'.

Highlighted
Alteryx Partner
Alteryx Partner

@G1 oh snap! my bad. I real talk know a guy we call G6 and that I think is why I made that connection in my head

Treyson Marks
Senior Analytics Engineer
PK Global
Highlighted
8 - Asteroid

You're forgiven