Solved

How do I strip string for specific characters

Posted on 2011-02-15
5
373 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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 set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now