Hello Brad,
suggest to use preg_* instead of ereg_*
extension is useless
Best regards,
=== At 2007-03-01, 11:12:52 you wrote: ===
Hey all,
I have been having some trouble with the eregi function. I have the
following piece of code in my application:
function
I agree with the first part, that it is in many cases better to use the
Perl Compatible Regular Expressions (PCRE, preg_*) than the POSIX
compatible ones (ereg[i]_*). However, I don't quite get what you mean by
extension is useless ? What extension...?? and why would it be
useless? (useless in
M.Sokolewicz wrote:
Hey all,
I have been having some trouble with the eregi function. I have
the following piece of code in my application:
function standard_input($input, $min=0, $max=50){
if (strlen($input) = $max and strlen($input) = $min ) {
$pattern = '^[a-z0-9\!\_
Myron Turner wrote:
M.Sokolewicz wrote:
$pattern = '^[a-z0-9\!\_ \.- ,/]*$';
if(!eregi($pattern, $input)){
the problem is that the hyphen is interpreted as regex range operator:
[a-z0-9\!\_ \.- ,/]
Rewrite this as
On Wed, February 28, 2007 9:08 pm, Brad wrote:
I have been having some trouble with the eregi function. I have the
following piece of code in my application:
function standard_input($input, $min=0, $max=50){
if (strlen($input) = $max and strlen($input) = $min ) {
Roberto Mansfield wrote:
Myron Turner wrote:
M.Sokolewicz wrote:
$pattern = '^[a-z0-9\!\_ \.- ,/]*$';
if(!eregi($pattern, $input)){
the problem is that the hyphen is interpreted as regex range operator:
On Thu, March 1, 2007 6:14 pm, Myron Turner wrote:
Roberto Mansfield wrote:
Myron Turner wrote:
M.Sokolewicz wrote:
$pattern = '^[a-z0-9\!\_ \.- ,/]*$';
if(!eregi($pattern, $input)){
the problem is that the hyphen is interpreted as regex range
operator:
Hey all,
I have been having some trouble with the eregi function. I have the
following piece of code in my application:
function standard_input($input, $min=0, $max=50){
if (strlen($input) = $max and strlen($input) = $min ) {
$pattern = '^[a-z0-9\!\_ \.- ,/]*$';
Subject: [PHP] Eregi error
Hey all,
I have been having some trouble with the eregi function. I have the
following piece of code in my application:
function standard_input($input, $min=0, $max=50){
if (strlen($input) = $max and strlen($input) = $min ) {
$pattern = '^[a-z0
I m trying to check $GP[sifre] variable, $GP[sifre] must consist of alpha
numeric chars only. here, how I check the variable:
if((eregi([^a-zA-Z0-9],$GP[sifre])
echo 'true';
else
echo 'false';
It works if variable starts with alphabetic chars only.
for example this returns 'ok'
[EMAIL PROTECTED] wrote:
I m trying to check $GP[sifre] variable, $GP[sifre] must consist of alpha
numeric chars only. here, how I check the variable:
Try this:
if(eregi(^[a-zA-Z0-9]+$,$GP[sifre]))
The above say that between the beginning of the string ^ and the end
of the string $,
[EMAIL PROTECTED] wrote:
if((eregi([^a-zA-Z0-9],$GP[sifre])
I think that the ^ anchor is your problem, it shall be out of the brackets :
if (eregi(^[a-zA-Z0-9]+$, $GP['sifre'])) echo 'true';
else echo 'false';
(the above is tested and works perfect)
P.S. Take a look here
Does anyone know a working eregi expression for determining a domain is
valid? don't need the http:// just looking for www.thedomain.com
cheers,
R.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
?php
$rootPath = ;
$cacheTime= 0;
$Diff = (time() - filemtime($rootPath.stuff.dat))/60;
$cntrp=0;
$cntrb=0;
$cntrt=0;
$cntrd=0;
$cntrc=0;
if ($Diff $cacheTime) {
$file = fopen (local file, r);
if (!$file) {
?php
$rootPath = ;
$cacheTime= 0;
$Diff = (time() - filemtime($rootPath.stuff.dat))/60;
$cntrp=0;
$cntrb=0;
$cntrt=0;
$cntrd=0;
$cntrc=0;
if ($Diff $cacheTime) {
$file = fopen (local file, r);
if (!$file) {
From: PHPDiscuss - PHP Newsgroups and mailing lists [EMAIL PROTECTED]
if (eregi ('trtd valign = topspan class = gray' . '[.+]'
'/span/td/tr/table', $line, $cont))
[.+] is going to match a literal period or plus sign and only one of them.
You either want just .+ to match one or more
Not sure how to accomplish this, and not completely familiar with all
the options available with regular expressions.
I need to sanitize input data by only allowing alpha-numeric characters,
whitespace, punctuation (,.;:) and of course carrige returns.
here is what I have so far...
Hi List,
I Know this is basic and I am sorry to bother the list with this question
but I am confused, probably working to hard :-)
I want to end up with a part of a string returned by $_POST to work with in
my function.
The string might be put into the text box like so, its a domain name
hi dave,
try this:
$temp = explode('.',$_POST['variable']);
$domainname = $temp[1];
greetz
da koenich
Hi List,
I Know this is basic and I am sorry to bother the list with this question
but I am confused, probably working to hard :-)
I want to end up with a part of a string returned by
On Thursday 11 March 2004 22:50, Dave Carrera wrote:
I want to end up with a part of a string returned by $_POST to work with in
my function.
The string might be put into the text box like so, its a domain name
checker,
http://www.domainname.com
I have already got rid of the http:// and
PROTECTED]
Subject: Re: [PHP] Eregi question
hi dave,
try this:
$temp = explode('.',$_POST['variable']);
$domainname = $temp[1];
greetz
da koenich
Hi List,
I Know this is basic and I am sorry to bother the list with this
question but I am confused, probably working to hard :-)
I want to end
PHP Gurus
A while ago on this list I posted a few questions about an eregi
filter for email addresses entered into a form. With the help of people
on this list, I settled on the following code which has worked fine in
the months since I started using it. The code is this:
eregi('[EMAIL
On 06 January 2004 15:53, Dave G wrote:
PHP Gurus
A while ago on this list I posted a few questions about an eregi
filter for email addresses entered into a form. With the help
of people
on this list, I settled on the following code which has worked fine in
the months since I
From: Dave G [EMAIL PROTECTED]
A while ago on this list I posted a few questions about an eregi
filter for email addresses entered into a form. With the help of people
on this list, I settled on the following code which has worked fine in
the months since I started using it. The code is this:
Mike,
No. You've only allowed for hyphens in the first element
after the @ sign
-- this address has them in the 2nd element.
Ah, yes, I guess I had it that way because there are no hyphens in top
level domain designations, but hadn't accounted for the fact that it
would exclude them if
Purpleonyx schrieb:
Greetings all, I ran into a problem today and was
hoping someone could provide an answer.
I am fetching a web page, and attempting to parse
certain variables from it. I've done this plenty of
times in the past with no problem. The only
difference this time is the file that I
Greetings all, I ran into a problem today and was
hoping someone could provide an answer.
I am fetching a web page, and attempting to parse
certain variables from it. I've done this plenty of
times in the past with no problem. The only
difference this time is the file that I am parsing is
much
On Wednesday 26 November 2003 06:32, Jas wrote:
Not sure how to do this but I have a call to a database which pulls the
contents of a table into an array and I need a eregi string which will
sift through the contents and put a line break (i.e. \n or br) after
each ;, } or {.
If that is
Not sure how to do this but I have a call to a database which pulls the
contents of a table into an array and I need a eregi string which will
sift through the contents and put a line break (i.e. \n or br) after
each ;, } or {. here is what I have so far...
while($b = mysql_fetch_array($sql))
Jas mailto:[EMAIL PROTECTED]
on Tuesday, November 25, 2003 2:32 PM said:
Not sure how to do this but I have a call to a database which pulls
the contents of a table into an array and I need a eregi string which
will sift through the contents and put a line break (i.e. \n or br)
after each
Jas wrote:
Not sure how to do this but I have a call to a database which pulls the
contents of a table into an array and I need a eregi string which will
sift through the contents and put a line break (i.e. \n or br) after
each ;, } or {. here is what I have so far...
function
Anyone have a good eregi filter for passwords?
Regards
R
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Erin wrote:
Anyone have a good eregi filter for passwords?
Regards
R
well, for one thing, don't use ereg. Use pcre, as it is faster.
preg_match('/^[a-zA-Z0-9]{5,16}$/',$blah);
that will validate a password containing only upper or lowercase letters
and numbers, between 5 and 16
Erin wrote:
Anyone have a good eregi filter for passwords?
Yes.
http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals
Derek Ford wrote:
Erin wrote:
Anyone have a good eregi filter for passwords?
well, for one thing, don't use ereg. Use pcre, as it is faster.
preg_match('/^[a-zA-Z0-9]{5,16}$/',$blah);
that will validate a password containing only upper or lowercase letters
and numbers, between 5 and 16
John W. Holmes wrote:
Derek Ford wrote:
Erin wrote:
Anyone have a good eregi filter for passwords?
well, for one thing, don't use ereg. Use pcre, as it is faster.
preg_match('/^[a-zA-Z0-9]{5,16}$/',$blah);
that will validate a password containing only upper or lowercase
letters and
elseif (eregi(a-ZA-9, $v_tel_filter)) {
echo '$v_tel_filter' Telephone Number Contains words;
} else {
im looking how to verify numbers alone and dash - can that be possible? I
have tried using a-ZA-9 but did not work.
any ideas?
thanks,
louie
--
Thank you,
Louie
--
PHP General
, July 07, 2003 5:10 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Eregi filtering..
elseif (eregi(a-ZA-9, $v_tel_filter)) {
echo '$v_tel_filter' Telephone Number Contains words;
} else {
im looking how to verify numbers alone and dash - can that be
possible? I
have tried using a-ZA-9 but did
-Original Message-
From: Ralph [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 08, 2003 8:20 AM
To: Miranda, Joel Louie M; [EMAIL PROTECTED]
Subject: RE: [PHP] Eregi filtering..
Here is one of doing this:
if(strrpos($v_tel_filter,' ') 0 || strspn($v_tel_filter,
0123456789-) != strlen
elseif (eregi(a-ZA-9, $v_tel_filter)) {
echo '$v_tel_filter' Telephone Number Contains words;
} else {
im looking how to verify numbers alone and dash - can that be possible? I
have tried using a-ZA-9 but did not work.
/^[\-\d]+$/ should match a string of just digits and dashes.
I've got a form that's posted to a php page where I'm attempting to validate a field
contains a valid email address. The eregi below seems to be totally ignored...
if (eregi(^[a-z0-9\._-]+@[a-z0-9\._-]+$, $emp_email)) {
echo centerplease enter a valid email address/center;
Dan,
I'll give you a little piece of advise that was given to me a little while
back on this list:
Go to http://www.killersoft.com/ and grab a copy of the validateEmailFormat
program.
QUOTE
PHP4 translation of Jeffrey E.F. Friedl's definitive Email Regex Program
from O'Reilly's Mastering
My main cnocern at this point is that the eregi is being totally ignored. I just want
to make sure the email address is in a valid format, not that it is a valid email
address. I'll look at validEmailFormat as well, but I don't understand why it's not
even being examined.
dan
* Justin
If the regexp matches, it is a valid email, so you need ! in front of it.
dan radom wrote:
I've got a form that's posted to a php page where I'm attempting to validate a field
contains a valid email address. The eregi below seems to be totally ignored...
if
Can someone tell me why this isn't working? To me it say open the file, read
it, stick into a variable, close the file. Then search that variable (the
file) and look for the eregi statements. Can someone tell me why this only
gets the first instance of what I'm searching for? Thanks a bunch.
On Saturday 08 June 2002 10:48, Robert Packer wrote:
Can someone tell me why this isn't working? To me it say open the file,
read it, stick into a variable, close the file. Then search that variable
(the file) and look for the eregi statements. Can someone tell me why this
only gets the first
Can anybody help me!!!
In my Windows2000 machine I use Apache 3.24 and PHP 4.0.6 and all is OK.
But when I transfer my code to work machine (Apache/1.3.22 (Unix)
(Red-Hat/Linux) mod_ssl/2.8.5 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.0.6
mod_perl/1.26)
the following script returns FALSE.
?php
According to the manual, the ereg functions are not binary safe. The
superior-in-every-way preg functions are. Perhaps you could try using
preg_grep instead.
$result = preg_grep('/' . preg_quote($imagename) . '/', $file);
You may find that strstr or something is even simpler.
miguel
On Tue,
I'm trying to match file names associated with a 3DS file (a 3DS file is a
common 3D file format). The file is binary by nature but as you can clearly
see in the dump below the filenames themselves are stored as plain text.
So I should be able to do a simple eregi() on the file and discover if
.);
exit;
}
Please help.
Denis
- Original Message -
From: Steve Buehler [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]
Cc: PHP [EMAIL PROTECTED]
Sent: Saturday, May 11, 2002 2:45 AM
Subject: Re: [PHP] eregi(mail)
Either Google is wrong (probably) or they are now allowing things like
On Tue, 21 May 2002, Denis L. Menezes wrote:
I use the following code, but it does not work. Is there something wrong?
If
(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.''.'[-!#$%\'*+\\/0-9=?A-Z^_`a
-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
$email_address))
One problem (syntax
Thanks to all who helped out with the eregi(mail)
stuff. I got my problem solved, and on top of that,
there were some bugs that I found in the code. Thanks
again to everyone.
__
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
Does anyone have a decent eregi statement for
validating e-mail addresses? I've tried the ones on
the site, but there seems to be small bugs with each
of them. They tell me that [EMAIL PROTECTED] is an
invalid e-mail address.
__
Do You Yahoo!?
Hi Liam:
On Fri, May 10, 2002 at 09:48:58AM -0700, Liam Gibbs wrote:
Does anyone have a decent eregi statement for
validating e-mail addresses?
eregi('^[a-z0-9_.=+-]+([a-z0-9-]+\.)+([a-z]{2,6})$', $Email);
Enjoy,
--Dan
--
PHP classes that make web design easier
SQL
On Fri, 10 May 2002, Liam Gibbs wrote:
Does anyone have a decent eregi statement for
validating e-mail addresses? I've tried the ones on
the site, but there seems to be small bugs with each
of them. They tell me that [EMAIL PROTECTED] is an
invalid e-mail address.
Well, it currently is an
it
was useful in some tiny miniscule sort of way. :)
--
Kevin Stone
[EMAIL PROTECTED]
- Original Message -
From: Analysis Solutions [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Friday, May 10, 2002 10:59 AM
Subject: Re: [PHP] eregi(mail)
Hi Liam:
On Fri, May 10, 2002 at 09
function check_input($array){
global $HTTP_REFERER;
$valid = 1;
if(gettype($array)==array) {
while (list($index, $subarray) = each($array) ) {
if(ereg(required_, $index) (($subarray == )
|| ($subarray == ))) {
On Fri, 10 May 2002, Kevin Stone wrote:
I had always been suspicious about email validators so I did a big long
search on Google about standard address formats. It turns out that aside
from the symbol emails have no standard format whatsoever. So ereg('',
$email) is really the only
On Fri, 10 May 2002, Steve Buehler wrote:
if(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.''.'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
If I'm reading it correctly, this will let invalid addresses through. The
domain component (after the sign) can only
Folks:
On Fri, May 10, 2002 at 01:27:45PM -0500, Steve Buehler wrote:
if(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.''.'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
$subarray)){
Those characters don't conform to the RFC.
: Re: [PHP] eregi(mail)
Hi Liam:
On Fri, May 10, 2002 at 09:48:58AM -0700, Liam Gibbs wrote:
Does anyone have a decent eregi statement for
validating e-mail addresses?
eregi('^[a-z0-9_.=+-]+@([a-z0-9-]+\.)+([a-z]{2,6})$', $Email);
Enjoy,
--Dan
--
PHP
To tell you the truth, I can't read it.
Steve
At 01:32 PM 5/10/2002, Miguel Cruz wrote:
On Fri, 10 May 2002, Steve Buehler wrote:
if(ereg('^[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.''.'[-!#$%\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
If I'm reading it correctly,
format is irrelevant.
-Kevin
- Original Message -
From: Miguel Cruz [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]
Cc: PHP-general [EMAIL PROTECTED]
Sent: Friday, May 10, 2002 12:30 PM
Subject: Re: [PHP] eregi(mail)
On Fri, 10 May 2002, Kevin Stone wrote:
I had always been suspicious
This is what I have used.
?
if(eregi(^[_.+a-z0-9-]+@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})\$,
$email)){
echo Good Email!;
}
?
Here is an excellent article on Regular Expressions.
Learning to Use Regular Expressions by Example
http://www.phpbuilder.com/columns/dario19990616.php3
On Fri, 10 May 2002, Kevin Stone wrote:
As we all know ARPA is thet university network, funded by the government
to build an information infrastructure that eventually became the
internet we have today. But the standards for text messaging within the
ARPA net have been added to over the
Hi,
I'm doing:
eregi($start(.*)end, $rf, $my_var);
And I want it to stop at the first presedence of $end, not the last (thats
what this is doing).
Any hints?
Best Regards
Fredrik A. Takle
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
On Thu, 2 May 2002, Fredrik Arild Takle wrote:
eregi($start(.*)end, $rf, $my_var);
And I want it to stop at the first presedence of $end, not the last (thats
what this is doing).
Try preg, which is faster and gives you more control (here the ?
munificence operator).
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Miguel Cruz) wrote:
On Thu, 2 May 2002, Fredrik Arild Takle wrote:
eregi($start(.*)end, $rf, $my_var);
And I want it to stop at the first presedence of $end, not the last (thats
what this is doing).
Try preg, which is faster and
On Thu, 2 May 2002, CC Zona wrote:
[EMAIL PROTECTED] (Miguel Cruz) wrote:
preg_match(/{$start}(.*?)end/, $rf, my_var);
Leave out the braces.
Don't they get removed by the parser's handling of double-quoted strings
long before anything makes it to preg_match()?
I almost always use the
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Miguel Cruz) wrote:
On Thu, 2 May 2002, CC Zona wrote:
[EMAIL PROTECTED] (Miguel Cruz) wrote:
preg_match(/{$start}(.*?)end/, $rf, my_var);
Leave out the braces.
Don't they get removed by the parser's handling of double-quoted strings
On Mon, 22 Apr 2002, Gregor Jaksa wrote:
if (!eregi(^[[:alpha:]]$, $HTTP_POST_VARS[vpis_ime]))
echo wrong char;
why does this always return wrong char no matter what value is in vpis_ime
... i tried blah, 242234 bla242h .. every single time i get wrong
char. im using PHP 4.1.2
The only
if (!eregi(^[[:alpha:]]$, $HTTP_POST_VARS[vpis_ime]))
echo wrong char;
why does this always return wrong char no matter what value is in vpis_ime
... i tried blah, 242234 bla242h .. every single time i get wrong
char. im using PHP 4.1.2
basicly is what i want is to check string if it contains
PROTECTED]
Sent: Monday, April 22, 2002 1:04 AM
Subject: [PHP] eregi() problem
if (!eregi(^[[:alpha:]]$, $HTTP_POST_VARS[vpis_ime]))
echo wrong char;
why does this always return wrong char no matter what value is in
vpis_ime
... i tried blah, 242234 bla242h .. every single time i get wrong
eregi('_[0-9]{4}.jpg$', $file_name)
should be
eregi('_[0-9]{4}\.jpg$', $file_name)
. is a spcial character(means every character) and has to be backslashed if
you want it's normal meaning
Jas [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I must be
the rest seems ok to me, if you search for files with e.g hello_.jpg as
name
Michael Virnstein [EMAIL PROTECTED] schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
eregi('_[0-9]{4}.jpg$', $file_name)
should be
eregi('_[0-9]{4}\.jpg$', $file_name)
. is a spcial
// second selection for main image on main page
$dir_name = /path/to/images/directory/;
$dir = opendir($dir_name);
$file_lost .= pFORM METHOD=\post\ ACTION=\done.php3\ NAME=\ad01\
SELECT NAME=\images\;
while ($file_names = readdir($dir)) {
if ($file_names != . $file_names !=..
jas wrote:
// second selection for main image on main page
$dir_name = /path/to/images/directory/;
$dir = opendir($dir_name);
$file_lost .= pFORM METHOD=\post\ ACTION=\done.php3\ NAME=\ad01\
SELECT NAME=\images\;
while ($file_names = readdir($dir)) {
if ($file_names != . $file_names
I must be doing something wrong, for that solution did not work.
Robert Cummings [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
jas wrote:
// second selection for main image on main page
$dir_name = /path/to/images/directory/;
$dir = opendir($dir_name);
Hi,
Can any1 send a small script of how to valiade a username using eregi().
I want username to consist only a-zA-Z1-0, _, and -
I can't get it to work correctly
Vlad
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Vlad Kulchitski wrote:
Hi,
Can any1 send a small script of how to valiade a username using eregi().
I want username to consist only a-zA-Z1-0, _, and -
I can't get it to work correctly
$pattern = [a-zA-Z0-9_\-]+;
this is meaning :
One word containing a-z or A-Z or 0-9 or _ or - with
I've never had time to get into those ereg, eregi etc. functions, and now
I am affraid I probably need to use them. Here is the problem I need to
solve:
I have a string (lead of an article), about 200-250 characters long. And
then I do have a search query - variable $q
Now, what I'd like to do
You don't need regular expressions for this.
To match case insensitive, just upper or lower case both strings
and use strpos() to find an occurence. Now you allready have the
position of the match it'll be easy to get that part of the string.
I suggest you substr() it into 3 parts and put the
Hello John
I'm using eregi to print out parts of a text file, and I was just wondering
how you get the code to print out a newline as it appears in the file.
Not quite sure what eregi has to do with it - perhaps I'm missing something.
Would the nl2br function help?
=dn
--
PHP General
Hi all,
I want a regular expression process such that,
no characters except for the followings will not be allowed.
0-9 a-z A-Z ~ @ # $ % ( ) _ - + =
[ ] { } ?
I create a web site with membership. I have a problem. Some body uses
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Mike Cullerton) wrote:
eregi(^[a-z0-9_\-]+$,$string)
notice that i had to escape the dash with a backslash
Are you sure? 'Cuz AFAIK, escaping shouldn't be necessary on a hyphen
which is the last char (or, IIRC, the first) of a character
on 10/2/01 8:51 AM, CC Zona at [EMAIL PROTECTED] wrote:
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Mike Cullerton) wrote:
eregi(^[a-z0-9_\-]+$,$string)
notice that i had to escape the dash with a backslash
Are you sure? 'Cuz AFAIK, escaping shouldn't be necessary on a hyphen
Hello,
Could anyone tell me how to eregi a word, to see if it only contains either
numbers, letters, the _ and the -, so that any other symbol with call it
invalid. For example, theres the word expressio_n that will be valid, but
the word express%^$-n will be invalid.
Thankyou,
Tim
--
PHP
See php.net/strcspn
On Mon, 1 Oct 2001, Tim Ballantine wrote:
Hello,
Could anyone tell me how to eregi a word, to see if it only contains either
numbers, letters, the _ and the -, so that any other symbol with call it
invalid. For example, theres the word expressio_n that will be valid,
Is there anything which doesnt use length? And something like eregi, because
it would be infeasible to list all of the symbols that a user could use, to
compare a string by.
Tim
Rasmus Lerdorf [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
See php.net/strcspn
Huh? You better read that documentation page again. You only need to
list the illegal symbols. And what do you mean by length?
-Rasmus
On Mon, 1 Oct 2001, Tim Ballantine wrote:
Is there anything which doesnt use length? And something like eregi, because
it would be infeasible to list all
Returns the length of the initial segment of str1 which does not contain
any of the characters in str2.
I realise that i could see if this matches with the length of the entire
word, and is there a way to get it to compare the word by the legal
characters, because the amount of illegal symbols,
Well, either you need to know the valid chars or the invalid ones. Make
up your mind and use strspn() or strcspn() appropriately.
-Rasmus
On Mon, 1 Oct 2001, Tim Ballantine wrote:
Returns the length of the initial segment of str1 which does not contain
any of the characters in str2.
I
Thankyou...
I should have made it clearer that I did want to use only the legal
characters to compare the string by.
Tim
Rasmus Lerdorf [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Well, either you need to know the valid chars or the invalid ones. Make
up
i realize a solution using strspn/strcspn was offered, but you asked for
eregi :)
anyway, i use ereg, but i think this should work
eregi(^[a-z0-9_\-]+$,$string)
notice that i had to escape the dash with a backslash
the plus sign forces atleast one character. you can use {x,y} in place of
the
Hello Jeff,
Sunday, August 26, 2001, 9:17:45 PM, you wrote:
JO I want to check if an uploaded file is an image. This isn't working.
JO Could anyone help me out?
JO if (!eregi(\\.gif$, $img1_name) ||
JO !eregi(\\.jpg$, $img1_name) ||
JO !eregi(\\.jpeg$, $img1_name)) {
JO error
I want to check if an uploaded file is an image. This isn't working.
Could anyone help me out?
if (!eregi(\\.gif$, $img1_name) ||
!eregi(\\.jpg$, $img1_name) ||
!eregi(\\.jpeg$, $img1_name)) {
error message
}
Jeff Oien
--
PHP General Mailing List (http://www.php.net/)
To
I want to delete some lines
original:
a href=http://www.example.com/1.html; ABCD/a
gt; a href=www.example.com/title.html#1234Football/a
a href=http://www.example.com/2.html; BCDE/a
gt; a href=www.example.com/title.html#2345Tennis/a
a href=http://www.example.com/3.html; CDEF/a
gt; a
Give this a try:
if(!ereg(^([0-9]{5}([-]{1}[0-9]{4})?)$,$data)) {
Kirk
-Original Message-
From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 8:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP] EREGI -- Help
I'm just trying to create a eregi expression
I'm just trying to create a eregi expression that will evaluate a zip
code... and I cannot get it to work... can anyone assist me with this? --
also, is there a site that shows regular expression examples for checking
fields like, zip codes, phone numbers, etc...
I have a script that looks for title tags,
but it doesn't seem to be picking up the titles, can anyone tell me
why?
Almost all of theweb pages look like:
?if(!isset($mainfile)) { include("mainfile.php");
}if(!isset($headers_sent)) { include("header.php");
}?!DOCTYPE HTML PUBLIC
100 matches
Mail list logo