Re: [PHP] regexp novice

2012-05-20 Thread Geoff Shang
Stuart Dallas stu...@3ft9.com wrote: On 18 May 2012, at 14:50, Jim Giner wrote: Daft is a little harsh. :) 00:40 is just not a time value that is generally accepted. It may appear harsh, but as far as I'm concerned it is daft to make assumptions like that. You've essentially disallowed

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
Jim Lucas li...@cmsws.com wrote in message news:4fb5decc.20...@cmsws.com... On 5/17/2012 9:52 PM, Jim Lucas wrote: How about this instead? pre?php $times = array( '100', # valid '1100', # valid '1300', # invalid '01:00', # valid '12:59', # valid '00:01', # valid '00:25pm', #

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
Jim Lucas li...@cmsws.com wrote in message news:4fb5decc.20...@cmsws.com... On 5/17/2012 9:52 PM, Jim Lucas wrote: How about this instead? pre?php $times = array( '100', # valid '1100', # valid '1300', # invalid '01:00', # valid '12:59', # valid '00:01', # valid '00:25pm', #

Re: [PHP] regexp novice

2012-05-18 Thread Stuart Dallas
On 18 May 2012, at 14:32, Jim Giner wrote: OK - I don't yet understand how this works, but it seems to work for almost all cases. The one erroneous result I get is from a value of 0040 (which I convert to 00:40 before hitting the regexp). It comes thru as Ok. If you have a fix for that

Re: [PHP] regexp novice

2012-05-18 Thread shiplu
On Fri, May 18, 2012 at 7:34 PM, Stuart Dallas stu...@3ft9.com wrote: Based on your requirements, 00:40 is completely valid. Why do you think it should be invalid? 00:40 is not a valid 12-hour format. BTW I just found another non-regex approach. Its even faster. function

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
Stuart Dallas stu...@3ft9.com wrote in message news:cc22e241-c1df-48e9-bf06-8a638a356...@3ft9.com... On 18 May 2012, at 14:32, Jim Giner wrote: OK - I don't yet understand how this works, but it seems to work for almost all cases. The one erroneous result I get is from a value of 0040

Re: [PHP] regexp novice

2012-05-18 Thread Stuart Dallas
On 18 May 2012, at 14:41, Jim Giner wrote: Stuart Dallas stu...@3ft9.com wrote in message news:cc22e241-c1df-48e9-bf06-8a638a356...@3ft9.com... On 18 May 2012, at 14:32, Jim Giner wrote: OK - I don't yet understand how this works, but it seems to work for almost all cases. The one

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
times so 40 minutes after minute would be a) not practical and b) still not I meant to say 40 minutes after MIDNIGHT. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
Stuart Dallas stu...@3ft9.com wrote in message news:79538829-bfc4-43a4-a413-72247b145...@3ft9.com... On 18 May 2012, at 14:41, Jim Giner wrote: Stuart Dallas stu...@3ft9.com wrote in message news:cc22e241-c1df-48e9-bf06-8a638a356...@3ft9.com... On 18 May 2012, at 14:32, Jim Giner wrote: OK

Re: [PHP] regexp novice

2012-05-18 Thread Stuart Dallas
On 18 May 2012, at 14:50, Jim Giner wrote: Daft is a little harsh. :) 00:40 is just not a time value that is generally accepted. It may appear harsh, but as far as I'm concerned it is daft to make assumptions like that. You've essentially disallowed 12:nn am, but allowed 1:nn am, 2:nn

Re: [PHP] regexp novice

2012-05-18 Thread Andreas Perstinger
On 2012-05-17 22:37, Jim Giner wrote: Trying to validate an input of a time value in the format hh:mm, wherein I'll accept anything like the following: hmm hhmm h:mm hh:mm in a 12 hour format. My problem is my test is ok'ing an input of 1300. Here is my test: if (0 ==

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
Stuart Dallas stu...@3ft9.com wrote in message news:aba011df-8cdf-4492-be4d-51c2b54c4...@3ft9.com... On 18 May 2012, at 14:50, Jim Giner wrote: Daft is a little harsh. :) 00:40 is just not a time value that is generally accepted. It may appear harsh, but as far as I'm concerned it is daft

Re: [PHP] regexp novice

2012-05-18 Thread tamouse mailing lists
On Thu, May 17, 2012 at 3:37 PM, Jim Giner jim.gi...@albanyhandball.com wrote: ok - finally had to come up with my own regexp - and am failing. Trying to validate an input of a time value in the format hh:mm, wherein I'll accept anything like the following: hmm hhmm h:mm hh:mm in a 12

[PHP] regexp novice

2012-05-17 Thread Jim Giner
ok - finally had to come up with my own regexp - and am failing. Trying to validate an input of a time value in the format hh:mm, wherein I'll accept anything like the following: hmm hhmm h:mm hh:mm in a 12 hour format. My problem is my test is ok'ing an input of 1300. Here is my test: if

Re: [PHP] regexp novice

2012-05-17 Thread shiplu
On Fri, May 18, 2012 at 2:37 AM, Jim Giner jim.gi...@albanyhandball.comwrote: ok - finally had to come up with my own regexp - and am failing. Trying to validate an input of a time value in the format hh:mm, wherein I'll accept anything like the following: hmm hhmm h:mm hh:mm in a 12

Re: [PHP] regexp novice

2012-05-17 Thread Yared Hufkens
Try this: /(0?[1-9]|[12][0-9]):?[0-5][0-9]/ FYI: ? is equal to {0,1}, and [1-9] to [123456789] (and therefore [1-2] to [12]). Am 17.05.2012 22:37, schrieb Jim Giner: ok - finally had to come up with my own regexp - and am failing. Trying to validate an input of a time value in the format

Re: [PHP] regexp novice

2012-05-17 Thread Jim Giner
Yared Hufkens y4...@yahoo.de wrote in message news:4fb5667d.7020...@yahoo.de... Try this: /(0?[1-9]|[12][0-9]):?[0-5][0-9]/ FYI: ? is equal to {0,1}, and [1-9] to [123456789] (and therefore [1-2] to [12]). Am 17.05.2012 22:37, schrieb Jim Giner: ok - finally had to come up with my own

Re: [PHP] regexp novice

2012-05-17 Thread Govinda
FWIW - I couldn't find much in the way of tutorials on the meanings of the various chars in regexp's. this helps alot: http://www.gskinner.com/RegExr/ you can paste your pattern (needle) in the top input, and hover over each char to see what it means in grep land. Paste your haystack in

Re: [PHP] regexp novice

2012-05-17 Thread Jim Giner
Thank you ! Govinda govinda.webdnat...@gmail.com wrote in message news:3e5dce87-29c1-4679-ad3a-53326435f...@gmail.com... FWIW - I couldn't find much in the way of tutorials on the meanings of the various chars in regexp's. this helps alot: http://www.gskinner.com/RegExr/ you can paste your

Re: [PHP] regexp novice

2012-05-17 Thread Jim Lucas
On 5/17/2012 1:57 PM, shiplu wrote: On Fri, May 18, 2012 at 2:37 AM, Jim Ginerjim.gi...@albanyhandball.comwrote: ok - finally had to come up with my own regexp - and am failing. Trying to validate an input of a time value in the format hh:mm, wherein I'll accept anything like the following:

Re: [PHP] regexp novice

2012-05-17 Thread Jim Giner
Jim Lucas li...@cmsws.com wrote in message news:4fb5b89e.8050...@cmsws.com... On 5/17/2012 1:57 PM, shiplu wrote: On Fri, May 18, 2012 at 2:37 AM, Jim Ginerjim.gi...@albanyhandball.comwrote: ok - finally had to come up with my own regexp - and am failing. Trying to validate an input of a

Re: [PHP] regexp novice

2012-05-17 Thread Jim Lucas
On 5/17/2012 8:07 PM, Jim Giner wrote: Jim Lucasli...@cmsws.com wrote in message news:4fb5b89e.8050...@cmsws.com... On 5/17/2012 1:57 PM, shiplu wrote: On Fri, May 18, 2012 at 2:37 AM, Jim Ginerjim.gi...@albanyhandball.comwrote: ok - finally had to come up with my own regexp - and am

Re: [PHP] regexp novice

2012-05-17 Thread Jim Lucas
On 5/17/2012 9:52 PM, Jim Lucas wrote: How about this instead? pre?php $times = array( '100', # valid '1100', # valid '1300', # invalid '01:00', # valid '12:59', # valid '00:01', # valid '00:25pm', # invalid '', # valid 'a00', # invalid '00', # invalid ); foreach ( $times AS $time ) echo

Re: [PHP] regexp novice

2012-05-17 Thread Shiplu
Jim L. I did't actually consider that wide range of time values. Here is an update. Still this can be written without help of regex. I must add one more thing that a '00:01' is invalid in 12 hour format. OP wants it to be 12-hour format. function valid_time($time){ $m = substr($time,

RE: [PHP] RegExp question: how to add a number?

2010-10-15 Thread Ford, Mike
-Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: 14 October 2010 21:42 Hi everyone, I hope you're doing well (haven't written here for a long time :-)). The question is as follows: I have a regexp that would do the following. If the string begins with Re:,

Re: [PHP] RegExp question: how to add a number?

2010-10-15 Thread Richard Quadling
On 15 October 2010 10:16, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: 14 October 2010 21:42 Hi everyone, I hope you're doing well (haven't written here for a long time :-)). The question is as follows: I have a

Re: [PHP] RegExp question: how to add a number?

2010-10-15 Thread Andrew Ballard
On Fri, Oct 15, 2010 at 5:52 AM, Richard Quadling rquadl...@gmail.com wrote: On 15 October 2010 10:16, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: 14 October 2010 21:42 Hi everyone, I hope you're doing well (haven't

Re: [PHP] RegExp question: how to add a number?

2010-10-15 Thread Richard Quadling
On 15 October 2010 15:45, Andrew Ballard aball...@gmail.com wrote: On Fri, Oct 15, 2010 at 5:52 AM, Richard Quadling rquadl...@gmail.com wrote: On 15 October 2010 10:16, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: 14

Re: [PHP] RegExp question: how to add a number?

2010-10-15 Thread Andrew Ballard
On Fri, Oct 15, 2010 at 11:07 AM, Richard Quadling rquadl...@gmail.com wrote: On 15 October 2010 15:45, Andrew Ballard aball...@gmail.com wrote: On Fri, Oct 15, 2010 at 5:52 AM, Richard Quadling rquadl...@gmail.com wrote: On 15 October 2010 10:16, Ford, Mike m.f...@leedsmet.ac.uk wrote:

[PHP] RegExp question: how to add a number?

2010-10-14 Thread Andre Polykanine
Hi everyone, I hope you're doing well (haven't written here for a long time :-)). The question is as follows: I have a regexp that would do the following. If the string begins with Re:, it will change the beginning to Re[2]:; if it doesn't, then it would add Re: at the beginning. But (attention,

Re: [PHP] RegExp question: how to add a number?

2010-10-14 Thread David Harkness
On Thu, Oct 14, 2010 at 1:42 PM, Andre Polykanine an...@oire.org wrote: But (attention, here it is!) if the string starts with something like Re[4]:, it should replace it by Re[5]:. Regular expressions do not support any mathematical operations. Instead, you need to use preg_match() to

Re: [PHP] RegExp question: how to add a number?

2010-10-14 Thread Richard Quadling
On 14 October 2010 21:42, Andre Polykanine an...@oire.org wrote: Hi everyone, I hope you're doing well (haven't written here for a long time :-)). The question is as follows: I have a regexp that would do the following. If the string begins with Re:, it will change the beginning to Re[2]:; if

RE: [PHP] regexp questions

2010-05-14 Thread Spud. Ivan.
Hi, I'm trying to insert a serialized data into mysql, but I does mysql_real_escape_string() before inserting it. INSERT IGNORE INTO `table` (`value`) VALUES ('a:3:{s:12:F1;s:6:nombre;s:11:F2;s:5:F3;s:16:F4;s:10:F5;}'); it result in INSERT IGNORE INTO `table` (`value`) VALUES

RE: [PHP] regexp questions

2010-05-14 Thread Spud. Ivan.
From: spudm...@hotmail.com To: php-general@lists.php.net Date: Fri, 14 May 2010 22:01:09 +0200 Subject: RE: [PHP] regexp questions Hi, I'm trying to insert a serialized data into mysql, but I does mysql_real_escape_string() before inserting it. INSERT IGNORE

RE: [PHP] regexp questions

2010-05-14 Thread Ashley Sheridan
On Fri, 2010-05-14 at 22:01 +0200, Spud. Ivan. wrote: Hi, I'm trying to insert a serialized data into mysql, but I does mysql_real_escape_string() before inserting it. INSERT IGNORE INTO `table` (`value`) VALUES

RE: [PHP] regexp questions

2010-05-12 Thread Ford, Mike
-Original Message- From: Spud. Ivan. [mailto:spudm...@hotmail.com] Sent: 11 May 2010 15:56 To: php-general@lists.php.net Subject: RE: [PHP] regexp questions hehe, but I can't find anything related to regexp. I've found something at http://php.net/preg_match Changelog Try

RE: [PHP] regexp questions

2010-05-12 Thread Spud. Ivan.
Subject: RE: [PHP] regexp questions Date: Wed, 12 May 2010 11:11:07 +0100 From: m.f...@leedsmet.ac.uk To: spudm...@hotmail.com; php-general@lists.php.net -Original Message- From: Spud. Ivan. [mailto:spudm...@hotmail.com] Sent: 11 May 2010 15:56 To: php-general

RE: [PHP] regexp questions

2010-05-12 Thread Spud. Ivan.
Date: Tue, 11 May 2010 15:38:41 -0700 From: li...@cmsws.com To: spudm...@hotmail.com CC: php-general@lists.php.net Subject: Re: [PHP] regexp questions Spud. Ivan. wrote: I think we've not so much only with the regex, but maybe you can tell me somethin helpful ;) /Word1

RE: [PHP] regexp questions

2010-05-12 Thread Ashley Sheridan
On Wed, 2010-05-12 at 18:13 +0200, Spud. Ivan. wrote: Date: Tue, 11 May 2010 15:38:41 -0700 From: li...@cmsws.com To: spudm...@hotmail.com CC: php-general@lists.php.net Subject: Re: [PHP] regexp questions Spud. Ivan. wrote: I think we've not so much only

RE: [PHP] regexp questions

2010-05-12 Thread Spud. Ivan.
Subject: RE: [PHP] regexp questions From: a...@ashleysheridan.co.uk To: spudm...@hotmail.com CC: php-general@lists.php.net Date: Wed, 12 May 2010 17:11:11 +0100 On Wed, 2010-05-12 at 18:13 +0200, Spud. Ivan. wrote: Date: Tue, 11 May 2010 15:38:41 -0700 From: li...@cmsws.com

RE: [PHP] regexp questions

2010-05-12 Thread Ashley Sheridan
On Wed, 2010-05-12 at 18:23 +0200, Spud. Ivan. wrote: Subject: RE: [PHP] regexp questions From: a...@ashleysheridan.co.uk To: spudm...@hotmail.com CC: php-general@lists.php.net Date: Wed, 12 May 2010 17:11:11 +0100 On Wed, 2010-05-12 at 18:13 +0200, Spud. Ivan. wrote

Re: [PHP] regexp questions

2010-05-12 Thread Karl DeSaulniers
On May 12, 2010, at 11:20 AM, Ashley Sheridan wrote: On Wed, 2010-05-12 at 18:23 +0200, Spud. Ivan. wrote: Subject: RE: [PHP] regexp questions From: a...@ashleysheridan.co.uk To: spudm...@hotmail.com CC: php-general@lists.php.net Date: Wed, 12 May 2010 17:11:11 +0100 On Wed, 2010-05-12

RE: [PHP] regexp questions

2010-05-11 Thread Spud. Ivan.
The flags parameter was added But it doesn't explain why my regexps work fine within php 5.1 but 5.3 Ivan. -Original Message- From: Spud. Ivan. [mailto:spudm...@hotmail.com] Sent: 11 May 2010 01:25 To: php-general@lists.php.net Subject: RE: [PHP] regexp

Re: [PHP] regexp questions

2010-05-11 Thread Shawn McKenzie
On 05/11/2010 09:56 AM, Spud. Ivan. wrote: But it doesn't explain why my regexps work fine within php 5.1 but 5.3 Ivan. Post a regex and what you think it should match but doesn't. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To

RE: [PHP] regexp questions

2010-05-11 Thread Spud. Ivan.
I think we've not so much only with the regex, but maybe you can tell me somethin helpful ;) /Word1:\/a\/h4\(a href=\http:\/\/www.thiswebsite.com\/some-script.php\fir.*?st word.*?(.*)Word2:\/a\/h4ul(.*)Second word:\/a\/h4ul(.*)Word3:\/a\/h4ul(.*)rd word/is Thanks. I.Lopez. On 05/11/2010

RE: [PHP] regexp questions

2010-05-11 Thread Ashley Sheridan
On Tue, 2010-05-11 at 22:45 +0200, Spud. Ivan. wrote: I think we've not so much only with the regex, but maybe you can tell me somethin helpful ;) /Word1:\/a\/h4\(a href=\http:\/\/www.thiswebsite.com\/some-script.php\fir.*?st word.*?(.*)Word2:\/a\/h4ul(.*)Second

RE: [PHP] regexp questions

2010-05-11 Thread Spud. Ivan.
From: a...@ashleysheridan.co.uk To: spudm...@hotmail.com CC: php-general@lists.php.net Date: Tue, 11 May 2010 21:43:54 +0100 Subject: RE: [PHP] regexp questions On Tue, 2010-05-11 at 22:45 +0200, Spud. Ivan. wrote: I think we've not so much only with the regex, but maybe you

RE: [PHP] regexp questions

2010-05-11 Thread Ashley Sheridan
On Tue, 2010-05-11 at 23:48 +0200, Spud. Ivan. wrote: From: a...@ashleysheridan.co.uk To: spudm...@hotmail.com CC: php-general@lists.php.net Date: Tue, 11 May 2010 21:43:54 +0100 Subject: RE: [PHP] regexp questions On Tue, 2010-05-11 at 22:45 +0200, Spud. Ivan. wrote

Re: [PHP] regexp questions

2010-05-11 Thread Jim Lucas
Spud. Ivan. wrote: I think we've not so much only with the regex, but maybe you can tell me somethin helpful ;) /Word1:\/a\/h4\(a href=\http:\/\/www.thiswebsite.com\/some-script.php\fir.*?st word.*?(.*)Word2:\/a\/h4ul(.*)Second word:\/a\/h4ul(.*)Word3:\/a\/h4ul(.*)rd word/is

[PHP] regexp questions

2010-05-10 Thread Spud. Ivan.
Hi, I've recently changed from php 5.1 to 5.3.2 and I'm havong problems with preg_match, because the same regular expressions used in php 5.1 are not matching anything in 5.3.2. There are any significant changes that I should know? I've been searching but I haven't found anything. Thanks.

Re: [PHP] regexp questions

2010-05-10 Thread shiplu
For example, the following regex doesn't work. return (bool) preg_match('/^[\pL\pN\pZ\p{Pc}\p{Pd}\p{Po}]++$/uD', (string) $str); Shiplu Mokadd.im My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation

RE: [PHP] regexp questions

2010-05-10 Thread Spud. Ivan.
Is there any place where to read the changelog or something? Thanks. For example, the following regex doesn't work. return (bool) preg_match('/^[\pL\pN\pZ\p{Pc}\p{Pd}\p{Po}]++$/uD', (string) $str); Shiplu Mokadd.im

[PHP] Regexp and Arrays

2010-01-02 Thread Allen McCabe
I have been plauged for a few days by this, can anyone see a problem with this function?? function printByType($string, $mode) { (string) $string; $lengths = array( 'VARCHAR' = 10 , 'TINYINT' = 1 , 'TEXT' = 10 , 'DATE' = 7 , 'SMALLINT' = 1 , 'MEDIUMINT' = 2 ,

Re: [PHP] Regexp and Arrays

2010-01-02 Thread shiplu
There can be a problem. But do you see a problem?? if yes. what is it? May be we can find the solution. -- Shiplu Mokaddim My talks, http://talk.cmyweb.net Follow me, http://twitter.com/shiplu SUST Programmers, http://groups.google.com/group/p2psust Innovation distinguishes bet ... ... (ask

Re: [PHP] Regexp and Arrays

2010-01-02 Thread Mari Masuda
On a quick glance I don't think you are doing the casting correctly. For example, you have stuff like: (string) $string; and (string) $key; (int) $val; and (int) $length_value = $match[1]; and the casted value is not being saved anywhere. I believe it should be something like $string =

Re: [PHP] Regexp and Arrays

2010-01-02 Thread Allen McCabe
I think part of the problem may lie in the use of variables in regular expressions. I am trying to use the perl-style preg_match(), but the regular expression values that it checks on each iteration of the foreach loop checks for a different value (hence, the use of a variable). On Sat, Jan 2,

[PHP] Regexp to get paramname

2008-08-18 Thread HostWare Kft.
Hi, I have these lines to get parameters' name to $regs, but I always get the first one twice. What do I do wrong? $sql = 'select * from hotsys where ALREND=:alrend and SYSKOD=:syskod'; eregi('(:[a-z,A-Z,0-9]+)', $sql, $regs); Thanks, SanTa -- PHP General Mailing List

Re: [PHP] Regexp to get paramname

2008-08-18 Thread Richard Heyes
eregi(); That would be your first mistake. The preg_* functions are better. -- Richard Heyes http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] RegExp

2006-12-22 Thread WeberSites LTD
@lists.php.net Subject: Re: [PHP] RegExp On Thu, December 14, 2006 11:47 pm, WeberSites LTD wrote: I'm trying to limit the text someone can submit in a text area with : Code: if(!preg_match(/^[à-úA-Za-z0-9_():,@\/\.\s\-\ ]*$/i,$FieldValue)) { } It works well but I'm having problems

Re: [PHP] RegExp

2006-12-15 Thread Jochem Maas
WeberSites LTD wrote: I'm trying to limit the text someone can submit in a text area with : Code: if(!preg_match(/^[א-תA-Za-z0-9_():,@\/\.\s\-\ ]*$/i,$FieldValue)) { ^^ ^-- no need for the space given you already have '\s'

Re: [PHP] RegExp

2006-12-15 Thread Richard Lynch
On Thu, December 14, 2006 11:47 pm, WeberSites LTD wrote: I'm trying to limit the text someone can submit in a text area with : Code: if(!preg_match(/^[à-úA-Za-z0-9_():,@\/\.\s\-\ ]*$/i,$FieldValue)) { } It works well but I'm having problems with the (double quote). If there is a

[PHP] RegExp

2006-12-14 Thread WeberSites LTD
I'm trying to limit the text someone can submit in a text area with : Code: if(!preg_match(/^[א-תA-Za-z0-9_():,@\/\.\s\-\ ]*$/i,$FieldValue)) { } It works well but I'm having problems with the (double quote). If there is a double quote () it fails.

Re: [PHP] RegExp for preg_split()

2006-04-29 Thread Richard Lynch
On Fri, April 28, 2006 11:16 am, Weber Sites LTD wrote: I'm looking for the RegExp that will split a search string into search keywords. while taking into account. From what I managed to find I can get all of the words into an array but I would like all of the words inside to be in the

RE: [PHP] RegExp for preg_split()

2006-04-29 Thread Weber Sites LTD
:[EMAIL PROTECTED] Sent: Saturday, April 29, 2006 10:29 AM To: Weber Sites LTD Cc: php-general@lists.php.net Subject: Re: [PHP] RegExp for preg_split() On Fri, April 28, 2006 11:16 am, Weber Sites LTD wrote: I'm looking for the RegExp that will split a search string into search keywords. while

Re: [PHP] RegExp for preg_split()

2006-04-29 Thread tedd
Hi: A summation of entries. http://xn--ovg.com/a/parse.php neat! tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] RegExp for preg_split()

2006-04-29 Thread Rafael
LOL It's interesting that you've taked your time and build that 'summation', maybe the only thing is missing is the code itself ;) Now, because you didn't add it, I had to check the different versions, and I agree with John Hicks, his suggestion seems to be the best one. tedd wrote: A

[PHP] RegExp for preg_split()

2006-04-28 Thread Weber Sites LTD
Hi I'm looking for the RegExp that will split a search string into search keywords. while taking into account. From what I managed to find I can get all of the words into an array but I would like all of the words inside to be in the same array cell. NE1? thanks berber

Re: [PHP] RegExp for preg_split()

2006-04-28 Thread tedd
At 6:16 PM +0200 4/28/06, Weber Sites LTD wrote: Hi I'm looking for the RegExp that will split a search string into search keywords. while taking into account. From what I managed to find I can get all of the words into an array but I would like all of the words inside to be in the same

Re: [PHP] RegExp for preg_split()

2006-04-28 Thread tedd
At 6:16 PM +0200 4/28/06, Weber Sites LTD wrote: Hi I'm looking for the RegExp that will split a search string into search keywords. while taking into account. From what I managed to find I can get all of the words into an array but I would like all of the words inside to be in the same

RE: [PHP] RegExp for preg_split()

2006-04-28 Thread Weber Sites LTD
@lists.php.net Subject: Re: [PHP] RegExp for preg_split() At 6:16 PM +0200 4/28/06, Weber Sites LTD wrote: Hi I'm looking for the RegExp that will split a search string into search keywords. while taking into account. From what I managed to find I can get all of the words into an array but I would

Re: [PHP] RegExp for preg_split()

2006-04-28 Thread John Hicks
Weber Sites LTD wrote: Hi I'm looking for the RegExp that will split a search string into search keywords. while taking into account. From what I managed to find I can get all of the words into an array but I would like all of the words inside to be in the same array cell. You want

[PHP] Regexp matching in SQL

2006-03-06 Thread Brian Anderson
I am trying to simplify an SQL query that is pretty much like below: $sql = SELECT * FROM table WHERE keyword RLIKE '$expression1' OR keyword RLIKE '$expression2' ; The different terms '$expression1' and '$expression1' come from an array. Is there any way to within one regular expression to

RE: [PHP] Regexp matching in SQL

2006-03-06 Thread jblanchard
[snip] I am trying to simplify an SQL query that is pretty much like below: $sql = SELECT * FROM table WHERE keyword RLIKE '$expression1' OR keyword RLIKE '$expression2' ; The different terms '$expression1' and '$expression1' come from an array. Is there any way to within one regular

Re: [PHP] Regexp matching in SQL

2006-03-06 Thread Brian Anderson
IN ( exp1, exp2) didn't seem to work for me. I've seen that used before for including a subquery, but somehow it didn't like the comma separated list. I think this below is doing it for me. $separated = implode(|, (explode( , (AddSlashes($_REQUEST['terms']);

Re: [PHP] Regexp matching in SQL

2006-03-06 Thread Chris
Brian Anderson wrote: IN ( exp1, exp2) didn't seem to work for me. I've seen that used before for including a subquery, but somehow it didn't like the comma separated list. I think this below is doing it for me. $separated = implode(|, (explode( , (AddSlashes($_REQUEST['terms']);

[PHP] Regexp trouble

2005-11-24 Thread Andy Pieters
Hi list I still fail to understand why regular expressions are causing me such a hard time. I used and tested my regexp in kregexpeditor (comes with Quanta [kdewebdev]) but when I put it in the php script it fails. ereg('^([\w]{3,3})[\s]([\d]{2,2})[\s]([\d]{2,2})[:]([\d]{2,2})[:]([\d]{2,2})'

Re: [PHP] Regexp trouble

2005-11-24 Thread David Grant
Andy, Try preg_match instead of ereg. Cheers, David Grant Andy Pieters wrote: Hi list I still fail to understand why regular expressions are causing me such a hard time. I used and tested my regexp in kregexpeditor (comes with Quanta [kdewebdev]) but when I put it in the php script

Re: [PHP] Regexp trouble

2005-11-24 Thread Frank Armitage
Andy Pieters wrote: Hi list I still fail to understand why regular expressions are causing me such a hard time. snip / Hi! Why don't you use 'preg_match'? And why do you use all those character classes? This: code $subject = 'Nov 22 06:51:36'; $pattern =

Re: [PHP] Regexp trouble

2005-11-24 Thread Jochem Maas
Andy Pieters wrote: Hi list I still fail to understand why regular expressions are causing me such a hard time. er, because they are hard? hey you failed! we have a club :-) I used and tested my regexp in kregexpeditor (comes with Quanta [kdewebdev]) but when I put it in the php script

Re: [PHP] Regexp trouble

2005-11-24 Thread Andy Pieters
Thanks all for your contributions. Seems like the missing link was the delimiter. On Thursday 24 November 2005 18:23, Frank Armitage wrote: And why do you use all those character classes? Err.. why NOT use character classes? What is easier [0-9] or \d or maybe [a-zA-Z] or [\w], ... ?

Re: [PHP] Regexp trouble

2005-11-24 Thread Frank Armitage
Andy Pieters wrote: Err.. why NOT use character classes? What is easier [0-9] or \d or maybe [a-zA-Z] or [\w], ... ? Well, first of all the square brackets in [\w] aren't needed, \w already means 'any word character'. Secondly, [a-zA-Z] is not the same as \w: A word character is any

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Eli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Eli wrote: Try: preg_replace('/(?=\)([^]*)(\w+)=(?!\'|\)([^\s]+)(?=\s|\)([^]*)(?=\)/U','\1\2=\3\4',$html); Hmm.. that could be a start.. and don't ask me how it works... :P Well.. problem with that, is that if you got more

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Eli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Eli wrote: Try: preg_replace('/(?=\)([^]*)(\w+)=(?!\'|\)([^\s]+)(?=\s|\)([^]*)(?=\)/U','\1\2=\3\4',$html); Hmm.. that could be a start.. and don't ask me how it works... :P Well.. problem with that, is that if you got more

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread Eli
Yup.. that was a good point.. ;) Take a look at this example: ?php function tag_rep($tag) { return reg_replace('/(?!\)(\S+)\s*=\s*(?![\'])([^\s\']+)(?![\'])/','\1=\2',$tag); } $html=p class=MsoNormal id=parfont size=3 face=\Comic Sans MS\span lang=NL

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread Eli
Sorry for the spam.. here it is: ?php function tag_rep($tag) { return preg_replace('/(?!\)(\S+)\s*=\s*(?![\'])([^\s\']+)(?![\'])/','\1=\2',$tag); } $html=p class=MsoNormal id=parfont size=3 face=\Comic Sans MS\span lang=NL style='font-size:12.0pt;font-family:\Comic Sans MS\'a

Re: [PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread Jochem Maas
Eli wrote: BlackDex wrote: Hello ppl, I have a question about regex and html parsing. I have the following code: --- p class=MsoNormalfont size=3 face=Comic Sans MSspan lang=NL style='font-size:12.0pt;font-family:Comic Sans MS'nbsp;/span/font/p you realise that that HTML ammounts the to the

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Thx... it works almost :P I Changed the code a bit so you can see the results quicker :). It doesn't change every attribute/value. I think this has to do something with the opening and closing of a tag . My code: --- ?php function tag_rep($tag) { return

Re: [PHP] PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread Jason Petersen
On Thu, 10 Mar 2005 00:18:05 +0100, BlackDex [EMAIL PROTECTED] wrote: Hello ppl, I have a question about regex and html parsing. I have the following code: --- p class=MsoNormalfont size=3 face=Comic Sans MSspan lang=NL style='font-size:12.0pt;font-family:Comic Sans MS'nbsp;/span/font/p

Re: [PHP] PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Jason Petersen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 10 Mar 2005 00:18:05 +0100, BlackDex [EMAIL PROTECTED] wrote: Hello ppl, I have a question about regex and html parsing. I have the following code: --- p class=MsoNormalfont size=3 face=Comic Sans MSspan

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Owkay.. i fixed it :). Here is the final code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread BlackDex
Owkay i fixed it :D. The regexp needed a /s (Pattern Modifier) also so that the .(DOT) also does newlines :). Now it is fixed... Thank you very much Eli :) /me is happy. THE CODE: --- ?php function tag_rep($tag) { return

[PHP] PHP RegExp and HTML tags attributes values etc...

2005-03-09 Thread BlackDex
Hello ppl, I have a question about regex and html parsing. I have the following code: --- p class=MsoNormalfont size=3 face=Comic Sans MSspan lang=NL style='font-size:12.0pt;font-family:Comic Sans MS'nbsp;/span/font/p --- It laks some quotemarks. I want to change it to: --- p

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-09 Thread Eli
BlackDex wrote: Hello ppl, I have a question about regex and html parsing. I have the following code: --- p class=MsoNormalfont size=3 face=Comic Sans MSspan lang=NL style='font-size:12.0pt;font-family:Comic Sans MS'nbsp;/span/font/p --- It laks some quotemarks. I want to change it to: --- p

[PHP] Re: PHP RegExp and HTML tags attributes values etc...

2005-03-09 Thread Eli
Eli wrote: Try: preg_replace('/(?=\)([^]*)(\w+)=(?!\'|\)([^\s]+)(?=\s|\)([^]*)(?=\)/U','\1\2=\3\4',$html); Hmm.. that could be a start.. and don't ask me how it works... :P Well.. problem with that, is that if you got more than 1 un-escaped attribute in a tag, the regex will fix only the first

Re: [PHP] Regexp stopped working on my site

2005-01-30 Thread Kristian Hellquist
The expression that I found won't work anymore is an own pseudo-lang markup that renders into html-lists. Expression for grabbing a list, Example: [lista] some text [/lista] @\[\s*(lista)\s*(sq|o|\*|#|a|i)?\s*\]([^\x00]*?)\[/[EMAIL PROTECTED] $3 is then treated separated into html

[PHP] Regexp stopped working on my site

2005-01-29 Thread Kristian Hellquist
Hi! I had a script for parsing text into html, similar to phpBB. Everything has been working fine until now. Some of my 'pseudotags' like [b] are still recognized (parsed into b) but some more advanced pattern matching is not. I haven't changed the code, but the php-version on the server has

Re: [PHP] Regexp stopped working on my site

2005-01-29 Thread Marek Kilimajer
Kristian Hellquist wrote: Hi! I had a script for parsing text into html, similar to phpBB. Everything has been working fine until now. Some of my 'pseudotags' like [b] are still recognized (parsed into b) but some more advanced pattern matching is not. I haven't changed the code, but the

[PHP] Regexp help second

2005-01-06 Thread Uro Gruber
Hi! Last help about regexp solve my problem, but I have another one. I've made some regexp but it does not work always Let say I have some strings 1) this is some domain.com test 2) domain.com I can make this work either for first example of fo second, but not for both. What I want is replace of

Re: [PHP] Regexp help second

2005-01-06 Thread Richard Lynch
You could maybe cheat and add an X at the beginning and end of the string before your Regex, then you will have: X\1 \2 \3X and you can strip off the initial X from \1 and the trailing X from \3 There's probably some fancy Regexp way to do it though. Uroš Gruber wrote: Hi! Last help about

Re: [PHP] Regexp help second

2005-01-06 Thread Andrew Kreps
On Thu, 06 Jan 2005 13:50:58 +0100, Uro Gruber [EMAIL PROTECTED] wrote: 1) this is some domain.com test 2) domain.com I can make this work either for first example of fo second, but not for both. What I want is replace of domain.com to get this is dome domain.com domain com test so

  1   2   >