Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^3: How to remove other language character from a string

by frozenwithjoy (Priest)
on Nov 26, 2012 at 05:51 UTC ( [id://1005565]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to remove other language character from a string
in thread How to remove other language character from a string

That's because it wasn't formatted correctly due to missing code tags (which were presumably left out so that the input text would be shown properly). When I first ran moritz's code, I just got the original string, but when I substituted:

$str =~ s/[^\p{Latin}\s]//g;

for this:

$str =~ s/^\p{Latin}\s//g;

it worked.

EDIT: If you have lots of extra spaces in your output, you could run it through $str =~ s/ {2,}/ /g;, too. Something to keep in mind is that moritz's approach (as is) will remove punctuation.

Replies are listed 'Best First'.
Re^4: How to remove other language character from a string
by Anonymous Monk on Nov 26, 2012 at 09:53 UTC
    It worked smoothly. Thanks Frozenwithjoy and moritz.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1005565]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-25 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found