It sounds as if you want URI::Escape (and maybe even Encode. Those should take care of the characters in the URL for you.
Remember that URIs will also need [@/+?&;=%$,] (the reserved chars) and [-_.!~*'()] (the unreserved set), as well as a few odds-and-ends chars. For the full specification, see RFC 2396.
| [reply] [d/l] [select] |
Sure, lots of people do. Though we'd be more inclined to help if we see what you've tried so far, what works, what doesn't work, some sample input data, etc. Take a look at How (Not) To Ask A Question for more details.
--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; =
qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
| [reply] [d/l] |
First thing to do is to read about regexen. They are really important for most things you do with Perl. I'd recommend that you start with perlretut, perlrequick, perlre and perlreref.
When you have done that you will know that a negated character class like [^a-zA-Z\d.:] is what you are after. But read the documentation first.
DWIM is Perl's answer to Gödel
| [reply] [d/l] |
| [reply] [d/l] [select] |
Premise
In reply to a /msg by GrandFather, I'll point out that the above links are not "broken", but refer to USENET urls and not everybody may have a news client installed nor a system configured to launch it on such urls, thus for ease of use I'll give GG urls for these clpmisc posts:
Summary
The whole thread started at this post. To sum up the story, someone asked something about some Perl code he's seen, which included \d. So someone else explained that (to quote literally)
\d matches "0", "1" ... "8" or "9"
At this point yet another poster answered that
Last time I checked, \d matched 268 different characters. Dear
programmer, if you mean 0-9, then write 0-9.
This spawned a sub discussion, because a fourth poster, and very well known contributor to the group pointed out that he while was aware that \w will match not only 'a'..'z', 'A'..'Z', '0'..'9', and '_', but possibly much more, depending on locale, it was not just obvious to him that \d will match anything but [0-9]. It was not obvious to me either, especially since I hardly know anything about this whole locales stuff, and that's why I'm reporting it here.
Further replies included two test/example scripts, which I'm pasting hereafter, unmodified.
The first script
The second script
Conclusion
Edit: g0n - readmore tags
| [reply] [d/l] [select] |
You're short many valid characters, but here goes:
@ok = grep !/[^a-zA-Z0-9.:]/, @list;
or
@ok = grep /^[a-zA-Z0-9.:]*\z/, @list;
| [reply] [d/l] [select] |