Regular Expression (newbie)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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!

Re: Regular Expression (newbie)


Quoted text here. Click to load it

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


Re: Regular Expression (newbie)

Quoted text here. Click to load it

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

Re: Regular Expression (newbie)

Cristisor wrote:
Quoted text here. Click to load it

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.


Re: Regular Expression (newbie)

This is how the .yml file look like:
    - /overlib/overlib_mini.js
    - /prototype/prototype.js
    - /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

Site Timeline