Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
n8schicht
Helper I
Helper I

remove all characters except a-zA-Z0-9-_ from column Title

Hi,

 

i have some csv-data:

number;title
1;ich bin text nur mit buchstaben und 123456
2;ich bin auch ein text aber mit vielen Sonderzeichen $ / & welche alle gelöscht werden sollen zahlen ( 123454) sollen aber erhalten bleiben
3;ich bin ein Dollarzeichen ($) und soll weg 
4;Ich bin 123“ gross und wiege 54,5 kg
5;mein name ist „Hase“ ich weiss nichts 

how can i only except a-zA-Z0-9-_, characters?

 

the result should be:

 

number;title
1;ich bin text nur mit buchstaben und 123456
2;ich bin auch ein text aber mit vielen Sonderzeichen welche alle gelöscht werden sollen zahlen 123454 sollen aber erhalten bleiben
3;ich bin ein Dollarzeichen und soll weg 
4;Ich bin 123 gross und wiege 54,5 kg
5;mein name ist Hase ich weiss nichts 
1 ACCEPTED SOLUTION

@n8schicht 

 

My bad. I think i gave a unneccessary lengthy code

 

Try this one

 

=let Characterstokeep={"0".."9","a".."z","A".."Z","_","-"," "}
in
Text.Select([title],Characterstokeep)

Regards
Zubair

Please try my custom visuals

View solution in original post

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

@n8schicht 

 

Give this a shot as Custom Column

 

=let Characterstoremove=List.RemoveItems(
List.Transform({1..126}, each Character.FromNumber(_)),{"0".."9","a".."z","A".."Z","_","-"," "})
in
Text.Remove([title],Characterstoremove)

Regards
Zubair

Please try my custom visuals

okay - this works but i see i have also those charaters in the string:

 

l

Ø

@n8schicht 

 

My bad. I think i gave a unneccessary lengthy code

 

Try this one

 

=let Characterstokeep={"0".."9","a".."z","A".."Z","_","-"," "}
in
Text.Select([title],Characterstokeep)

Regards
Zubair

Please try my custom visuals

Hey - yes! thx

 

you also have a idea to let the german umlauts pass? 

like

ä ö ü Ä Ö Ü ß

 

 

I will check and get back tomorrow.

Regards
Zubair

Please try my custom visuals

zorry my mistake of course:

 

let Characterstokeep={"0".."9","a".."z","A".."Z","_","-"," ","ä","ü","ö","ß","Ä","Ü","Ö"}
in
Text.Select([Title],Characterstokeep)

but now i have a little not funny side effect:

from:

Buschbeck Grillkamin Carmen mit Tisch, grau/terra, 65 x 180 x 203 cm

to:

Buschbeck Grillkamin Carmen mit Tisch grauterra 65 x 180 x 203 cm

is there a way to do this:

Buschbeck Grillkamin Carmen mit Tisch - grau - terra - 65 x 180 x 203 cm

so i mean:

- if there is a character which would be cut is there a possibility to separate them with a 

-

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.