468,247 Members | 1,338 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

Regexp question: ()'^% etc => _

Q
Hi,

I want to make a 'plain' filename from a database entry..
So eg:

Test (for ^@@\example-etc.)%&#.html
==>
Test_for_example-etc._.html

Pleaaaaaaaase???
:-)))

Regards,
Marco
Mar 9 '06 #1
5 1083
d
Q" <do********@hotmail.com> wrote in message
news:44***********************@news.xs4all.nl...
Hi,

I want to make a 'plain' filename from a database entry..
So eg:

Test (for ^@@\example-etc.)%&#.html
==>
Test_for_example-etc._.html

Pleaaaaaaaase???
I use something like this:

$s=preg_replace("/[^A-Z0-9_\-\.]+/i", "_", strtolower($s));
$s=preg_replace("/_{2,}/", "_", $s);

which does what you want :)

dave
:-)))

Regards,
Marco

Mar 9 '06 #2
Did you have a question or are you just giving everyone a demonstration
of funny looking filenames? Are we supposed to pick our favorite? Or
are you trying to say that you currently have a database full of
examples of corrupt filenames and you want to create a similar database
with filenames that are not quite as corrupt but are still funny
looking? Or are you designing a new syntax of regexp that specilized in
finding files who's names match a specific pattern? Or are you creating
a new programming language with the fewest number of reserved words
possible?

Or are you creating a new operating system that uses a crytic command
prompt/syntax designed for use in scifi movies? Because if so, it looks
good so far but make sure you have an "override" command so that the
hero can bypass the villans security lockout at the very last minute to
open the gas chamber and save the girl! Also use IMPACT 72pt for all
text.

-Robert

Mar 9 '06 #3
Q
huh?
"rlee0001" <ro*********@hotmail.com> schreef in bericht
news:11**********************@j33g2000cwa.googlegr oups.com...
Did you have a question or are you just giving everyone a demonstration
of funny looking filenames? Are we supposed to pick our favorite? Or
are you trying to say that you currently have a database full of
examples of corrupt filenames and you want to create a similar database
with filenames that are not quite as corrupt but are still funny
looking? Or are you designing a new syntax of regexp that specilized in
finding files who's names match a specific pattern? Or are you creating
a new programming language with the fewest number of reserved words
possible?

Or are you creating a new operating system that uses a crytic command
prompt/syntax designed for use in scifi movies? Because if so, it looks
good so far but make sure you have an "override" command so that the
hero can bypass the villans security lockout at the very last minute to
open the gas chamber and save the girl! Also use IMPACT 72pt for all
text.

-Robert

Mar 9 '06 #4
Q
@Robert:

FYI:
Was only trying to find "a" way to create readable (and valid) filenames in
combination with apache rewrite rules...
The funny chars were only there so the guru's knew to "group" them to one _

Ok?

@d:
THANKS!!!! :-)

"rlee0001" <ro*********@hotmail.com> schreef in bericht
news:11**********************@j33g2000cwa.googlegr oups.com...
Did you have a question or are you just giving everyone a demonstration
of funny looking filenames? Are we supposed to pick our favorite? Or
are you trying to say that you currently have a database full of
examples of corrupt filenames and you want to create a similar database
with filenames that are not quite as corrupt but are still funny
looking? Or are you designing a new syntax of regexp that specilized in
finding files who's names match a specific pattern? Or are you creating
a new programming language with the fewest number of reserved words
possible?

Or are you creating a new operating system that uses a crytic command
prompt/syntax designed for use in scifi movies? Because if so, it looks
good so far but make sure you have an "override" command so that the
hero can bypass the villans security lockout at the very last minute to
open the gas chamber and save the girl! Also use IMPACT 72pt for all
text.

-Robert

Mar 9 '06 #5
d
"rlee0001" <ro*********@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Did you have a question or are you just giving everyone a demonstration
of funny looking filenames? Are we supposed to pick our favorite? Or
are you trying to say that you currently have a database full of
examples of corrupt filenames and you want to create a similar database
with filenames that are not quite as corrupt but are still funny
looking? Or are you designing a new syntax of regexp that specilized in
finding files who's names match a specific pattern? Or are you creating
a new programming language with the fewest number of reserved words
possible?

Or are you creating a new operating system that uses a crytic command
prompt/syntax designed for use in scifi movies? Because if so, it looks
good so far but make sure you have an "override" command so that the
hero can bypass the villans security lockout at the very last minute to
open the gas chamber and save the girl! Also use IMPACT 72pt for all
text.
Having "safe" filenames can be very beneficial. I use them all the time as
a way to make very human-readable URLs, without sprawling masses of crap. I
know not everyone in this group feels the need to have properly-manicured
URLs, but I do.

Do you hate the md5() function, too? All that does is turn a
perfectly-readable message into 32 characters of crap. I suppose we should
ditch that and wipe out the creator's family with attack helicopters.

I didn't think his question prompted such a response. It's a perfectly
reasonable question.
-Robert

Mar 9 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by denisb | last post: by
1 post views Thread by python_charmer2000 | last post: by
19 posts views Thread by Magnus Lie Hetland | last post: by
5 posts views Thread by Lukas Holcik | last post: by
6 posts views Thread by Mark Johnson | last post: by
7 posts views Thread by Csaba Gabor | last post: by
11 posts views Thread by HopfZ | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.