Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi guys, Had this issue which is somewhat foxing me... there are two stages to this issue.

Stage 1) I will take a input for a name from a user, I wish to apply a regex to validate that the name is what I would consider a name, so all chars A-Za-z, a space, a . etc... however I also need to accept accented characters like åäöüíìóòúùñÑéèáàêëûãç_öüæøÅÄÖÉØÁÜÆØâîÂÎ... I even tried this in the regex but sometimes it fails... I think this is something to do with how the file is saved... my test scripts dont work properly... so is there a better way of doing this ?

Stage 2) I need to replace the accented chars with non accented equivalent (as the mainframe they eventually end up in do not accept them. I have used several regex's like

my $t = shift; $t =~ s/(ä|Ä)/AE/g; #Ä $t =~ s/(ö|Ö)/OE/g; #Ö $t =~ s/(ü|Ü)/UE/g; #Ü $t =~ s/(ß)/SZ/g; #ß $t =~ s/(å|á|æ|â)/a/g; #ä|å|á|æ $t =~ s/(ø)/o/g; #ö $t =~ s/(é)/e/g; #é $t =~ s/(î)/i/g;#î $t =~ s/(Î)/I/g;#Î $t =~ s/(Å|Á|Æ|Â)/A/g;#Å|Ä|Á|Æ $t =~ s/(Ö|Ø)/O/g; $t =~ s/[^a-z0-9\,\.\s\/\-\@\:]//ig; return $t;

Any tips in solving this greatly appreciated.


In reply to Matching Accented Names by ropey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-25 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found