Solved

How do I strip string for specific characters

Posted on 2011-02-15
5
375 Views
Last Modified: 2012-05-11
I have a string entered dynamically, that I want to strip for any characters, that is not english. Example: Jürgen should be Jrgen.
How would I do that.
0
Comment
Question by:petersego
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 34904385
Why not Jurgen or Juergen
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 34904480
Anyway
str = str.replace(/[^a-zA-Z]/g,"")
0
 

Author Comment

by:petersego
ID: 34904491
Because I dont know what special characters might be used. There might be dozens of unknown characters like ê, ë, õ, æ and I cant make rules for everyone.
But if its possible I would love it.
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 34904530
I would find a page with some standard replacement rules.
Off the top of my head:

ö,ø => oe
ä,æ => ae
å => aa
ü => ue
èéë => e

then there are some language specific ones, like ÿ in Dutch can be ij
http://en.wikipedia.org/wiki/Diacritic

But perhaps more important WHY do you want to replace? If everything is in UTF8, then no need to
0
 

Author Closing Comment

by:petersego
ID: 34904551
Yes, you are right about the replacement rules - too. Thanks a lot.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flash doesn't load in Iphone and Ipad 22 489
Consuming WCF in Action Script 3 [ flash Develop ] 3 314
Adobe Indesign CS6 4 121
Text Transformation using ActionScript 3 5 139
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question