Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

how to replace '??' or '?' with " ' " and replace "#NAME?" with space in Regex-field,

Fang2023
5 - Atom

 

Hi, 

 

I tried to replace '??' or '?' with " ' " and replace "#NAME?" with space in Regex-field, but it doesn't work.

Any suggestions?

Thanks.


Regex_replace(
Regex_replace(
Regex_replace([_CurrentField_],"#NAME?"," "),
" ??", "'"),"?","'")

 

Wrong    
IDAB 
1plansit wasn?t hard
2#NAME?We didn??t prepare
3#NAME?Questions 
4#NAME?#NAME? 
    
Correct   
IDAB 
1plansit wasn't hard
2adminWe didn't prepare
3washing dishesQuestions 
4tracking deliveryyes,it's meaning
5 REPLIES 5
caltang
17 - Castor
17 - Castor

What is your original dataset? The above (wrong/correct) seems to be the end product. 

 

Also, you want to change:

?

??

#NAME?

 

What do you want to change them to?

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Fang2023
5 - Atom

Thanks Calvin

The wrong one is the original dataset(csv file). The correct one is the end product I need.

when I click #NAME? in WRONG table, it shows like: 

A2        =-admin  

A3        =- washing dishes

A4        =-tracking delivery

B4        =-Yes, it's meaning

 

Correct output: 

A2       admin  

A3       washing dishes

A4       tracking delivery

B4       Yes, it's meaning

 

The original dataset :

B1     it wasn?t hard

B2     We didn??t prepare

 

The correct output :

B1     it wasn't hard

B2     We didn't prepare

Yoshiro_Fujimori
15 - Aurora

Hi @Fang2023 ,

 

Where do you see the wrong characters (e.g. "#NAME?") ?

I guess you see it when you open the file on Excel.

If so, could you attach the input .csv file and the output .xlsx file?

Raj
16 - Nebula

@Fang2023 Please add a sample file of your input 
will be better position to help.

danilang
19 - Altair
19 - Altair

Hi @Fang2023 

 

? is a reserved character in regex meaning zero or one.  If you want to match on those, you have to escape them with \ 

 

Regex_replace(
Regex_replace(
Regex_replace([_CurrentField_],"#NAME\?"," "),
" \?\?", "'"),"\?","'")

 

You also have a space in your " \?\?" string.  You need to take this out.

 

Dan

Labels