Camilo,
What exactly are you trying to achieve? Meaning:
if (true)
do this;
if (false)
do that;
However, here's a link that I used long back to help me with some RegEx :
http://www.gskinner.com/RegExr/
Regards,
Shreyas
On Wed, Aug 18, 2010 at 11:31 PM, Camilo Sperberg
On Wed, 2010-08-18 at 23:36 +0530, Shreyas Agasthya wrote:
Camilo,
What exactly are you trying to achieve? Meaning:
if (true)
do this;
if (false)
do that;
However, here's a link that I used long back to help me with some RegEx :
http://www.gskinner.com/RegExr/
Regards,
On Wed, Aug 18, 2010 at 15:01, Ashley Sheridan a...@ashleysheridan.co.ukwrote:
On Wed, 2010-08-18 at 23:36 +0530, Shreyas Agasthya wrote:
Camilo,
What exactly are you trying to achieve? Meaning:
if (true)
do this;
if (false)
do that;
However, here's a link that I used long back
On Mon, Dec 22, 2008 at 15:56, Rene Fournier renefourn...@gmail.com wrote:
Each line should start with a $dollar sign, then some arbitrary text, ends
with a percent sign, followed by carriage-return and line-feed. Sometimes
though, the final line is not complete. In that case, I want to save
Rene Fournier wrote:
Hi, I'm looking for some ideas on the best way to parse blocks of text
that is formatted such as:
$sometext %\r\n-- good data
$otherstring %\r\n-- good data
$andyetmoretext %\r\n-- good data
2008/12/22 Jim Lucas li...@cmsws.com:
Rene Fournier wrote:
Hi, I'm looking for some ideas on the best way to parse blocks of text
that is formatted such as:
$sometext %\r\n-- good data
$otherstring %\r\n-- good data
$andyetmoretext %\r\n
it. I tried the code you posted, for now it is blocking
blank fields.
Thank you
- Original Message
From: Richard Lynch [EMAIL PROTECTED]
To: Adil Drissi [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, March 4, 2008 3:09:09 PM
Subject: Re: [PHP] regular expressions
PROTECTED]
To: Adil Drissi [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, March 4, 2008 3:09:09 PM
Subject: Re: [PHP] regular expressions question
On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote:
Is there any way to limit the user to a set of characters for example
say i want my user
- Original Message
From: Richard Lynch [EMAIL PROTECTED]
To: Adil Drissi [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, March 4, 2008 3:09:09 PM
Subject: Re: [PHP] regular expressions question
On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote:
Is there any way
On 3/4/08, Adil Drissi [EMAIL PROTECTED] wrote:
Hi,
Is there any way to limit the user to a set of characters for example say i
want my user to enter any character between a and z (case insensitive). And
if the user enters just one letter not belonging to [a-z], this will not be
accepted.
On Tue, Mar 4, 2008 at 2:19 PM, Adil Drissi [EMAIL PROTECTED] wrote:
Hi,
Is there any way to limit the user to a set of characters for example say i
want my user to enter any character between a and z (case insensitive). And
if the user enters just one letter not belonging to [a-z], this
On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote:
Is there any way to limit the user to a set of characters for example
say i want my user to enter any character between a and z (case
insensitive). And if the user enters just one letter not belonging to
[a-z], this will not be accepted.
I
Thank you guys,
The answers you gave me not only solved the problem,
but i included more characters like space and -.
Thank you again
--- Richard Lynch [EMAIL PROTECTED] wrote:
On Tue, March 4, 2008 1:19 pm, Adil Drissi wrote:
Is there any way to limit the user to a set of
characters for
At 2:04 AM -0500 12/12/07, Robert Cummings wrote:
?php
if( strlen( $pw1 ) 6
||
!ereg( '[[:digit:]]', $pw1 )
||
strlen( ereg_replace( '[^[:alpha:]]', '', $pw1 ) ) 2
||
strlen( ereg_replace( '[[:alnum:][:space:]]', '', $pw1 ) ) 1 )
{
// error message
}
?
Cheers,
On Tue, 2007-12-11 at 22:33 -0800, Liz Kim wrote:
I am trying to do a password match with php..
It needs to be at least 6 characters, contains 2 alphabets and at least 1
number or a special character...
if
(!preg_match(/^.*(?=.{6,})((?=.*\d)|(?=.*[,[EMAIL
There was no escaping in the original either.
Also, I did assume that the list of replacements would grow to become
pretty large. I wouldn't suggest doing this for a small list such as
that given in the example.
Robert Cummings wrote:
On Wed, 2007-11-07 at 14:33 +, Mark Summers wrote:
On Wed, 2007-11-07 at 14:53 +, Mark Summers wrote:
There was no escaping in the original either.
Also, I did assume that the list of replacements would grow to become
pretty large. I wouldn't suggest doing this for a small list such as
that given in the example.
Given that you expect
This is a much better solution. I didn't realise that str_replace()
accepted arrays as arguments for the search and replace terms.
Mental note: reading mailing lists backwards doesn't work.
Robert Cummings wrote:
On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote:
2007/11/6,
On Wed, 2007-11-07 at 14:33 +, Mark Summers wrote:
This is a first attempt but the general idea is that the regular
expression matching is done in one operation and then str_replace() is
called only as many times as required instead of once for every line in
your list. Also, str_replace()
This is a first attempt but the general idea is that the regular
expression matching is done in one operation and then str_replace() is
called only as many times as required instead of once for every line in
your list. Also, str_replace() is faster than ereg_replace().
?php
$replace = array(
Maybe this helps
?php
$line = preg_replace_callback(
'/(aacute;|eacute;|iacute;|oacute;|uacute;|ntilde;)/',
create_function(
// single quotes are essential here,
// or alternative escape all $ as \$
'$matches',
you could do it without any function
?php
$line = Hola que tal con aacute; con acento y entilde;e \n;
echo preg_replace('/([aeioun])(acute|tilde);/i','\1',$line);
?
On Nov 6, 2007 2:44 PM, Ezequiel Gutesman [EMAIL PROTECTED]
wrote:
Maybe this helps
?php
$line = preg_replace_callback(
True, but you'll have to change the rexex not to match, 'nacute;' or
'atilde; for example (unless you want it)
Thiago Ferreira wrote:
you could do it without any function
?php
$line = Hola que tal con aacute; con acento y entilde;e \n;
echo
Alberto García Gómez wrote:
I'm a mess in regular expressions and I make this code:
$link = ereg_replace('ntilde;','n',$link);
$link = ereg_replace('aacute;','a',$link);
$link = ereg_replace('eacute;','e',$link);
$link = ereg_replace('iacute;','i',$link);
$link =
2007/11/6, Alberto García Gómez [EMAIL PROTECTED]:
I'm a mess in regular expressions and I make this code:
$link = ereg_replace('ntilde;','n',$link);
$link = ereg_replace('aacute;','a',$link);
$link = ereg_replace('eacute;','e',$link);
$link = ereg_replace('iacute;','i',$link);
$link =
On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote:
2007/11/6, Alberto García Gómez [EMAIL PROTECTED]:
I'm a mess in regular expressions and I make this code:
$link = ereg_replace('ntilde;','n',$link);
$link = ereg_replace('aacute;','a',$link);
$link =
Robert Cummings wrote:
On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote:
2007/11/6, Alberto García Gómez [EMAIL PROTECTED]:
I'm a mess in regular expressions and I make this code:
$link = ereg_replace('ntilde;','n',$link);
$link = ereg_replace('aacute;','a',$link);
$link =
On Tue, 2007-11-06 at 20:15 -0800, Jim Lucas wrote:
Robert Cummings wrote:
On Tue, 2007-11-06 at 23:24 -0300, Martin Alterisio wrote:
2007/11/6, Alberto García Gómez [EMAIL PROTECTED]:
I'm a mess in regular expressions and I make this code:
$link = ereg_replace('ntilde;','n',$link);
2007. 05. 22, kedd keltezéssel 03.35-kor Don Don ezt írta:
Hi all, am trying to run a regular expression to a list of user entered data
on some forms.
I've creating what i think is a matching pattern for each category as shown
below:
function validateEntry($regularExpression,
On 5/22/07, Zoltán Németh [EMAIL PROTECTED] wrote:
2007. 05. 22, kedd keltezéssel 03.35-kor Don Don ezt írta:
Hi all, am trying to run a regular expression to a list of user entered data
on some forms.
I've creating what i think is a matching pattern for each category as shown
below:
Don Don wrote:
Hi all, am trying to run a regular expression to a list of user entered data on
some forms.
I've creating what i think is a matching pattern for each category as shown
below:
function validateEntry($regularExpression, $fieldValue)
{
if(preg_match($regularExpression,
Don Don wrote:
Hi all, am trying to run a regular expression to a list of user entered data
on some forms.
I've creating what i think is a matching pattern for each category as shown
below:
function validateEntry($regularExpression, $fieldValue)
{
if(preg_match($regularExpression,
At 11:42 PM +0200 11/29/06, Dotan Cohen wrote:
On 20/11/06, Paul Novitski [EMAIL PROTECTED] wrote:
-snip-
Paul, I just got around to reading this thread. The post of yours that
I quote above has got to be one of the best posts that I've read in
the 5 years that I've been on and off the php list.
On 20/11/06, Paul Novitski [EMAIL PROTECTED] wrote:
Børge,
Here's how I would think this one through:
First, I'm having to make several guesses at the nature of your text content:
- You use the single word topic but I'll assume
this can be multiple words and spaces.
- Your source string
Darrell Brogdon wrote:
Can you elaborate a little? Do you mean that you want certain letters
to have a numeric representation?
-D
no, what I was meaning was in relationship to each other, whether they
are the same letter or not.
--
PHP General Mailing List (http://www.php.net/)
To
Is there a way to make a regular expression to match on a particular way
the letters are arranged? For instance, if you had a word:
THAT
It could match on any word in the dictionary that had the form:
1231
preg_,match('/^(\w){1}\w\w\1$/');
would match the above on a single line for
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Okay, what I am referring to is cryptograms, where one letter is
substituted for another. I would like to be able to list all the words
in a dictionary that have that arrangement of their letters. Later on,
I would like to be able to do an entire
John Meyer wrote:
Is there a way to make a regular expression to match on a particular way
the letters are arranged? For instance, if you had a word:
THAT
It could match on any word in the dictionary that had the form:
1231
I think something like this might be possible using
Can you elaborate a little? Do you mean that you want certain
letters to have a numeric representation?
-D
On Nov 14, 2006, at 6:57 PM, John Meyer wrote:
Is there a way to make a regular expression to match on a
particular way
the letters are arranged? For instance, if you had a word:
On Mon, October 16, 2006 4:01 pm, Curt Zirzow wrote:
That makes me wonder.. according to the docs U inverts greediness, if
you have...
/foo.*?bar/U
does that make .*? a greedy .*
I believe I stubbed my toe on that fact once, yes...
I always manage to mess up the greedy/ungreedy stuff, and
On Sat, October 14, 2006 4:19 pm, Morten Twellmann wrote:
I'm trying to understand these regular expressions, but I can't make
them
work...
All I want to do, is to find the first occurrence of some text inside
the
HTML tags h1 and /h1.
Example string: pOctober 14, 2006/ph1Welcome to my
On 10/16/06, Chrome [EMAIL PROTECTED] wrote:
*edit* sorry I didn't think and just hit reply on this instead of reply
all... sorry Richard */edit*
[snip]
.*? is kinda silly -- .* mean 0 or more characters, and ? means maybe
but putting them together has no added value, so lose the ?
[/snip]
I
On Mon, October 16, 2006 2:54 pm, Chrome wrote:
*edit* sorry I didn't think and just hit reply on this instead of
reply
all... sorry Richard */edit*
[snip]
.*? is kinda silly -- .* mean 0 or more characters, and ? means
maybe
but putting them together has no added value, so lose the ?
[snip]
? means maybe in some other place in PCRE. Or maybe that's POSIX.
Never have figured that one out.
[/snip]
? directly after an expression is equivalent to {0,1} (maybe) but after a
quantifier (*, +, {}) means ungreedy
I'm sure I'll be corrected if I'm wrong :)
Dan
--
-general@lists.php.net
Sent: Monday, October 16, 2006 7:42 PM
Subject: Re: [PHP] Regular expressions
On Sat, October 14, 2006 4:19 pm, Morten Twellmann wrote:
I'm trying to understand these regular expressions, but I can't make
them
work...
All I want to do, is to find the first
On 10/16/06, Richard Lynch [EMAIL PROTECTED] wrote:
On Mon, October 16, 2006 2:54 pm, Chrome wrote:
*edit* sorry I didn't think and just hit reply on this instead of
reply
all... sorry Richard */edit*
[snip]
.*? is kinda silly -- .* mean 0 or more characters, and ? means
maybe
but
On 10/16/06, Chrome [EMAIL PROTECTED] wrote:
[snip]
? means maybe in some other place in PCRE. Or maybe that's POSIX.
Never have figured that one out.
[/snip]
? directly after an expression is equivalent to {0,1} (maybe) but after a
quantifier (*, +, {}) means ungreedy
I kind of talked about
On 10/16/06, Chrome [EMAIL PROTECTED] wrote:
[snip]
? means maybe in some other place in PCRE. Or maybe that's POSIX.
Never have figured that one out.
[/snip]
? directly after an expression is equivalent to {0,1} (maybe) but
after a quantifier (*, +, {}) means ungreedy
I kind of talked
On Sat, 14 Oct 2006 23:19:13 +0200, Morten Twellmann [EMAIL PROTECTED]
wrote:
I'm trying to understand these regular expressions, but I can't make them
work...
All I want to do, is to find the first occurrence of some text inside the
HTML tags h1 and /h1.
Example string: pOctober 14,
On 4/12/06, Chris Westbrook [EMAIL PROTECTED] wrote:
I have a problem. I'm trying to get a Google search results page via snoopy
and then display the links of the results it returns in an application. I
know about the fetchlinks function in snoopy, but I'm having trouble getting
the text
[snip]
I have one small problem I don't understand the preg_replace() method.
I understand the gist of what it does but I still don't fully know
what it does. I have read the entry in the php manual about this and
I am still confused about it. I've never been any good with regular
expressions.
Gustav Wiberg wrote:
?php
$lines = file('export/nhExportVarupiraten.txt');
// Loop through our array, show HTML source as HTML source; and line
numbers too.
foreach ($lines as $line_num = $line) {
echo Line #b{$line_num}/b : . htmlspecialchars($line) . br /\n;
if ($line_num 0 ) {
- Original Message -
From: Jasper Bryant-Greene [EMAIL PROTECTED]
To: PHP General php-general@lists.php.net
Sent: Sunday, October 09, 2005 8:06 PM
Subject: Re: [PHP] Regular expressions
Gustav Wiberg wrote:
?php
$lines = file('export/nhExportVarupiraten.txt');
// Loop through our
The best I found is:
O'Reilly book - Mastering Regular Expressions
On 8/3/05, -k. [EMAIL PROTECTED] wrote:
Has anyone here tried to learn Regular expressions with RegexBuddy?
http://www.regular-expressions.info/regexbuddy.html
It looks pretty cool, and even has some PHP specific
Stefan Lemmen wrote:
Hi,
I've want to dig a bit deeper into regular expressions for php.
I wonder if anyone can help me choosing between 2 books I'm considering buying:
1. Open Source Regular Expression Recipes - Nathan A Good
2. Mastering Regular Expressions - Jeffrey Freidl
If your
On Wed, 03 Aug 2005 12:10:40 -0500, Edward Vermillion wrote:
Stefan Lemmen wrote:
Hi,
I've want to dig a bit deeper into regular expressions for php.
I wonder if anyone can help me choosing between 2 books I'm considering
buying:
1. Open Source Regular Expression Recipes - Nathan A
Has anyone here tried to learn Regular expressions with RegexBuddy?
http://www.regular-expressions.info/regexbuddy.html
It looks pretty cool, and even has some PHP specific stuff, but you have to pay
to play.
-k.
__
Do You Yahoo!?
Tired of
For example I want to math this stream:
123 mm 334
What is the pattern that math with this stream?
Thanks
On 4/29/05, Malcolm Mill [EMAIL PROTECTED] wrote:
What is it you want to do?
On 4/29/05, Khorosh Irani [EMAIL PROTECTED] wrote:
Hello
I have a question:
What is in the role of
Khorosh Irani wrote:
For example I want to math this stream:
123 mm 334
What is the pattern that math with this stream?
Thanks
123[[:space:]]+mm[[:space:]]+334
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
* Khorosh Irani [EMAIL PROTECTED]:
For example I want to math this stream:
123 mm 334
What is the pattern that math with this stream?
Depends on what regexp function you use, what exactly you want to match,
and whether or not you want to know, after you match, any of the
segments. Rasmus has
pete M wrote:
I've been messing about with this for a while to no avail.. so help
would be appreciates
I'm new to regular expressions and tried this with preg_replace, now I'm
using eregi_replace !
here's the text
$txt = 'span style=font-size: 10pt; font-family: Times New
Roman;Itbr /
blahh
The pattern
$pattern = 'font\-size:.*?\;';
throwns the error
eregi_replace(): REG_BADRPT
Erwin Kerk wrote:
pete M wrote:
I've been messing about with this for a while to no avail.. so help
would be appreciates
I'm new to regular expressions and tried this with preg_replace, now
I'm using
pete M wrote:
The pattern
$pattern = 'font\-size:.*?\;';
throwns the error
eregi_replace(): REG_BADRPT
Well, this should work (tested and all )
$pattern=|font\-size:.*?;|si;
$txt = preg_replace( $pattern, , $txt );
Erwin
--
Thankyou
Diolch
danka
There seems to be a big difference between eregi_replace() and preg_replace
Am reding teh Sams - Regular Expressions in 10 mins bu the syntax seems
ot be different. !!
regards
pete
Erwin Kerk wrote:
pete M wrote:
The pattern
$pattern = 'font\-size:.*?\;';
throwns the error
On Tuesday 12 April 2005 18:30, jem777 wrote:
Php docs are quite messy about what works with what function...
This is my problem; I want to strip out spaces from my tags:
$word = [ / quote ];
$word = eregi_replace([[[:blank:]]*quote[[:blank:]]*], [quote],
$word); $word =
ok for this 2:
$body = preg_replace('|\[\s*quote\s*\]|', '[quote]', $body);
$body = preg_replace('|\[\s*/\s*quote\s*\]|', '[/quote]', $body);
but have these next instructions the same result?
$body = eregi_replace(\[ *quote *\], [quote], $body);
$body = eregi_replace(\[ */ *quote *\], [/quote],
[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
on Friday, April 08, 2005 3:43 PM said:
The ' apostrophe or can cause an early truncation of the data. My
code thinks that the closing identifier is after the word Joe and the
rest of the input is lost. Further, if the data does get by and it
Ok that would solve my SQL statements from breaking but how about in the
submitted form data at submit time?
John
[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
on Friday, April 08, 2005 3:43 PM said:
The ' apostrophe or can cause an early truncation of the data. My
code thinks that the
[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
on Friday, April 08, 2005 4:08 PM said:
Ok that would solve my SQL statements from breaking but how about in
the submitted form data at submit time?
Do you mean you're having this problem?
input type=text name=.. value=She said Hi! /
?
If so,
[EMAIL PROTECTED] wrote:
Windows 2000 Server
IIS 5/Apache 1.3.33
MySQL 4.1.1
Smarty 2.6.9
PHP 5.0.3
Hi all,
I am looking for help handling a form input to SQL. I believe the solution has to do with regular expressions.
My big problem is that when a user submits data such as:
Joe's Crabshack
The
[EMAIL PROTECTED] wrote:
snip
Joe's Crabshack
The ' apostrophe or can cause an early truncation of the data. My code thinks
that the closing identifier is after the word Joe and the rest of the input is lost.
Further, if the data does get by and it could possibly break a SQL statement.
Am I
On Fri, April 8, 2005 3:43 pm, [EMAIL PROTECTED] said:
I am looking for help handling a form input to SQL. I believe the solution
has to do with regular expressions.
My big problem is that when a user submits data such as:
Joe's Crabshack
The ' apostrophe or can cause an early truncation
On Thu, 27 Jan 2005 11:36:39 -0800, Rick Fletcher [EMAIL PROTECTED] wrote:
/^(1?[1-9]|[12]0)$/ works too. The first part covers 1-9, 11-19; the
second part gets you 10 and 20.
Plus, it's ever so slightly shorter! And isnt' that what's most
important? :P
absolutely, and you managed it
Zouari Fourat wrote:
Hello,
I need to verify if $x is between 1 and 20 and i need to do that with
regular expressions ?
anyone can help me outta there ?
thanks a lot
http://www.php.net/operators.comparison
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
[snip]
I need to verify if $x is between 1 and 20 and i need to do that with
regular expressions ?
anyone can help me outta there ?
[/snip]
Why regex?
if((1 $x) ($x 20)){
it's true
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Hello Zouari,
Thursday, January 27, 2005, 7:33:04 AM, you wrote:
Z I need to verify if $x is between 1 and 20 and i need to do that
Z with regular expressions ?
If you *need* to do it with regexp, try this:
if (preg_match(/[2-19]/,$x))
echo It is!;
If 1 and 20 are
Zouari Fourat wrote:
here's the problem :
my user MUST input only digits between 1 and 20
doing a is_numeric and some comparaison can be bypassed by inputing :
.5
or
0.5
or
5.1
or
0.3
or
.01
...
...
so i thought that the smartest way is to use regex
if( $i = 1 $i = 20 $i == (int)$i) ...
--
PHP
if (preg_match(/[2-19]/,$x))
echo It is!;
doesnt work !
this is working fine :
if (eregi(^-?([1-3])+$,$x)
echo x is 1 or 2 or 3;
On Thu, 27 Jan 2005 08:42:19 -0700, Leif Gregory [EMAIL PROTECTED] wrote:
Hello Zouari,
Thursday, January 27, 2005, 7:33:04 AM, you wrote:
Z I need to
this is working fine :
if (eregi(^-?([1-3])+$,$x)
echo x is 1 or 2 or 3;
i forgot to say that doesnt work with 1-20 :(
how to do it ?
On Thu, 27 Jan 2005 16:53:55 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
if (preg_match(/[2-19]/,$x))
echo It is!;
doesnt work !
this is working
to Marek Kilimajer :
$i='5.';
if (($i=1) ($i=20) ($i==(int)$i))
echo 'yes';
// yes
:'(
On Thu, 27 Jan 2005 16:52:20 +0100, Marek Kilimajer [EMAIL PROTECTED] wrote:
Zouari Fourat wrote:
here's the problem :
my user MUST input only digits between 1 and 20
Zouari Fourat wrote:
to Marek Kilimajer :
$i='5.';
if (($i=1) ($i=20) ($i==(int)$i))
echo 'yes';
// yes
:'(
ok, then use regexp:
if (($i=1) ($i=20) regexp('^[0-9]+$', $i))
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
On Thu, 27 Jan 2005 16:56:05 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
this is working fine :
if (eregi(^-?([1-3])+$,$x)
echo x is 1 or 2 or 3;
i forgot to say that doesnt work with 1-20 :(
how to do it ?
You're far better off doing it arithmetically as someone already said,
Robin :
$i='2';
if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) {
echo 'yes';
}else
echo 'no';
stdout: no
Marek :
$i='02';
if (($i=1) ($i=20) (eregi('^[0-9]+$', $i)))
echo 'yes';
stdout: yes
i hate
Zouari Fourat wrote:
Robin :
$i='2';
if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) {
Open the bracket for the last parameter...
/^(20|1[0-9]|[1-9])$/
-^
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To
Hello Zouari,
Thursday, January 27, 2005, 8:53:55 AM, you wrote:
Z doesnt work !
Z this is working fine :
Z if (eregi(^-?([1-3])+$,$x)
Z echo x is 1 or 2 or 3;
Whoops. Sorry.. That's what I get for throwing out an answer while on
the run:
Try this:
?php
for ($x=0; $x 120; $x++)
{
if
Zouari Fourat wrote:
Robin :
$i='2';
if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) {
You are missing a [ before the 1-9 in after the last |
The regex WILL work if you type it correctly :-)
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List
Robin Vickery wrote:
On Thu, 27 Jan 2005 16:56:05 +0100, Zouari Fourat [EMAIL PROTECTED] wrote:
this is working fine :
if (eregi(^-?([1-3])+$,$x)
echo x is 1 or 2 or 3;
i forgot to say that doesnt work with 1-20 :(
how to do it ?
if (preg_match('/^(20|1[0-9]|1-9])$/', $candidate)) {
//
Hello Rick,
Thursday, January 27, 2005, 12:36:39 PM, you wrote:
R /^(1?[1-9]|[12]0)$/ works too. The first part covers 1-9, 11-19;
R the second part gets you 10 and 20.
R Plus, it's ever so slightly shorter! And isnt' that what's most
R important? :P
Purty :grin:
--
Leif (TB lists
ereg((([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?),$zn[1],$zaakn
ummers1);
I thought that ereg would get all of them and store them in the array
$zaaknummers1 however this is not the case
I just asked a question similar to this the other day.
Try using;
Thx,
Just joined today, should have looked thru the archives first though.
Jack
-Original Message-
From: Alex Hogan [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 28, 2004 3:31 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Regular expressions Q
ereg
Arik Raffael Funke wrote:
Hello together,
I am havin trouble with php regular expressions. I would like to
implement following pattern Last Name:\s*(.*)\n.
- From following text,
Name: James
Last Name: Jason
Street: abc
I get just 'Jason'. But what I currently get is:
Jason
Street: abc
Obviously
Obviously the new-line is missed. Any thoughts on this?
sample code:
ereg(Last Name:\s*(.*)\n, $strInput, $regs)
echo $regs[1];
try this:
ereg(Last Name:\s*(.*[^\n]), $strInput, $regs);
echo $regs[1];
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thu, 15 Jul 2004 08:02:13 -0500
Matt M. [EMAIL PROTECTED] wrote:
Obviously the new-line is missed. Any thoughts on this?
sample code:
ereg(Last Name:\s*(.*)\n, $strInput, $regs)
echo $regs[1];
try this:
ereg(Last
On Thursday 15 July 2004 21:15, Arik Raffael Funke wrote:
However if I have,
Last Name:
Street: Teststreet
(no entry after last name)
Both search strings return me:
Street: Teststreet
Also why doesn't Last Name:\s*(.*)$ work, and neither ^Last
Name:\s*(.*). Both strings are
Hi,
Sunday, June 20, 2004, 7:23:53 AM, you wrote:
A Anyone know of a good regular expressions tester/designer for php coding
A running windows.
A I've looked at the Rad Software Regular Expressions Designer and it
A looks pretty good except that it is intended for .net and it really
A doesn't
Tom Rogers sagde:
This works with perl regular expressions
http://weitz.de/files/regex-coach.exe
Thanks! Great tool! I really needed something like that.
It just seems like it can't handle $1, $2 ...$x in the replacement string?
Isn't there a way to make that work ?
--
PHP General
On Sat, 19 Jun 2004 17:23:53 -0400, Al [EMAIL PROTECTED] wrote:
Anyone know of a good regular expressions tester/designer for php coding
running windows.
I've looked at the Rad Software Regular Expressions Designer and it
looks pretty good except that it is intended for .net and it really
Gabino Travassos mailto:[EMAIL PROTECTED]
on Thursday, April 22, 2004 12:24 PM said:
I'm wondering if Regular Expressions are the same in Perl and PHP (and
possibly Actionscript)? They look the same and smell the same, but if
I see a book in a store for Perl Regular Expressions that's $10
From: Gabino Travassos [EMAIL PROTECTED]
I'm wondering if Regular Expressions are the same in Perl and PHP (and
possibly Actionscript)? They look the same and smell the same, but if I
see
a book in a store for Perl Regular Expressions that's $10 cheaper than the
PHP one (is there one?), then
I forgot to mention that in my XML file, inside the quotes in this attribute
backColour=xx the x's will be variable..., so I need some kind of
wildcard to select everything from backColour + the next 8 or 9
characters, cuz it might be backColour=333990 or whatnot.
'backColour' will be a
1 - 100 of 200 matches
Mail list logo