By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,723 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,723 IT Pros & Developers. It's quick & easy.

Regular Expression (newbie)

P: n/a
Hi. I'm not good at all with regular expressions, so maybe someone can
help me with this: I need to create a regular expression that accepts
everything except the word upload. The regular expression for
everything is this: [a-zA-Z_0-9]+, but how can I solve the second part
of my problem? Thank you!
Oct 5 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
..oO(Cristisor)
>Hi. I'm not good at all with regular expressions, so maybe someone can
help me with this: I need to create a regular expression that accepts
everything except the word upload. The regular expression for
everything is this: [a-zA-Z_0-9]+, but how can I solve the second part
of my problem? Thank you!
You don't need a regex here. Simply use strpos() to check for the word
"upload".

Micha
Oct 5 '08 #2

P: n/a
On Oct 5, 7:59 pm, Michael Fesser <neti...@gmx.dewrote:
.oO(Cristisor)
Hi. I'm not good at all with regular expressions, so maybe someone can
help me with this: I need to create a regular expression that accepts
everything except the word upload. The regular expression for
everything is this: [a-zA-Z_0-9]+, but how can I solve the second part
of my problem? Thank you!

You don't need a regex here. Simply use strpos() to check for the word
"upload".

Micha
my problem is that I have e regular expression in a .yml file and I'm
using it for some kind of validation, to know when to include or not
something. so I don't think I can use strpos() in this file, right?
thanks for the help Micha
Oct 6 '08 #3

P: n/a
Cristisor wrote:
On Oct 5, 7:59 pm, Michael Fesser <neti...@gmx.dewrote:
>.oO(Cristisor)
>>Hi. I'm not good at all with regular expressions, so maybe someone can
help me with this: I need to create a regular expression that accepts
everything except the word upload. The regular expression for
everything is this: [a-zA-Z_0-9]+, but how can I solve the second part
of my problem? Thank you!
You don't need a regex here. Simply use strpos() to check for the word
"upload".

Micha

my problem is that I have e regular expression in a .yml file and I'm
using it for some kind of validation, to know when to include or not
something. so I don't think I can use strpos() in this file, right?
thanks for the help Micha
Can you be more specific about what your overall goal is? Maybe
posting a sample of the yml file, and clearly showing what you're
trying to look at in the file would be more helpful.

You can read the yml file into a PHP string with file_get_contents,
and check for "upload" before including the file. strpos() would work
in the PHP file that does the including.

--
Curtis
Oct 8 '08 #4

P: n/a
This is how the .yml file look like:
dizy_WebApp[A-Za-z_]*:
[a-zA-Z_0-9]+:
- /overlib/overlib_mini.js
- /prototype/prototype.js
.........
browseCommunity|overview:
- /gadget.js

So for everything I include prototype.js and the other file for
overview I include also gadget.js, but there is one situation where I
don't want to include prototype.js because I'm including another
framework and this makes the application crash because they can't work
together. So either I give up including prototype.js everywhere and I
include manually in every file, or I find a regular expression that
doesn't allow me to include prototype when I'm in this module called
uploadImage. Thank you
Oct 9 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.