Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
stephbzr
Contributor III
Contributor III

Regular expression for one case

Hi, I can't find a regex model to handle two columns in my dataset.

 

Example :

 

RF_

RX_S

AF_G

EJ_

FG_

 

Expected result (remove the last _) :

 

RF

RX_S

AF_G

EJ

FG

 

Thanks for your help!

1 Solution

Accepted Solutions
8 Replies
gjeremy1617088143
Creator III
Creator III

Hi @Stéphane Barbezier​ 

first case :

"_$"

an underscore at the end of the line.

second case :

"^0(?!\\d+)"

a 0 at the beginning of the line not followed by one digit ore more digit

send me love and Kudos

stephbzr
Contributor III
Contributor III
Author

I have already tried this solution and it doesn't work ! Here is an illustration of my tReplace : 

0695b00000Sss5AAAR.pngResult: identical, no change

I attach my excel file with the example.

 

For the second case, I found a solution : tConvertype (integer) sets this automatically 

Thank you for your suggestion

 

gjeremy1617088143
Creator III
Creator III

use advanced mode and not simple mode, or play with the checkbox global expression and whole word.

https://help.talend.com/r/en-US/7.2/processing/treplace

stephbzr
Contributor III
Contributor III
Author

I had used the advanced mode, but it does not change anything. Maybe underscore is used in the regex models to match a string while I want to match this underscore

PeggieP
Contributor
Contributor

Nice and amazing post this one is, thanks for sharing.

 

 

gjeremy1617088143
Creator III
Creator III

I've tested it with advance mode it's working :

 

replace"_$" by ""

 

input :

dgg_

ddf_dfdgg

_dgds_dgd

 

output:

dgg

ddf_dfdgg

_dgds_dgd

 

 

you can check in the tReplace component Schema if you have your fields in the output schema

stephbzr
Contributor III
Contributor III
Author

Can you share a screenshot with me? I followed the instructions, but it doesn't work for me, maybe I missed something...

Setting :

0695b00000Sst4SAAR.pngResult :

0695b00000Sst4hAAB.png