Re: [PHP] regexp novice

2012-05-20 Thread Geoff Shang
Stuart Dallas" 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 12:nn am, but al

Re: [PHP] regexp novice

2012-05-18 Thread tamouse mailing lists
On Thu, May 17, 2012 at 3:37 PM, Jim Giner 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 hour format.  My prob

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
"Stuart Dallas" 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 to make as

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 == preg_match("/([0][1-9]

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 a

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
"Stuart Dallas" wrote in message news:79538829-bfc4-43a4-a413-72247b145...@3ft9.com... On 18 May 2012, at 14:41, Jim Giner wrote: > "Stuart Dallas" 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 und

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 Stuart Dallas
On 18 May 2012, at 14:41, Jim Giner wrote: > "Stuart Dallas" 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 err

Re: [PHP] regexp novice

2012-05-18 Thread Jim Giner
"Stuart Dallas" 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 (which > I > c

Re: [PHP] regexp novice

2012-05-18 Thread shiplu
On Fri, May 18, 2012 at 7:34 PM, Stuart Dallas 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 valid_time_Shiplu2($time) { s

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 th

Re: [PHP] regexp novice

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

Re: [PHP] regexp novice

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

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, -2)

Re: [PHP] regexp novice

2012-05-17 Thread Jim Lucas
On 5/17/2012 9:52 PM, Jim Lucas wrote: How about this instead? \d{1,2}):?(?P\d{2})$#', $time, $m); if ( $m && ( 0 <= (int) $m['hour'] && 12 >= (int) $m['hour'] ) && ( 0 <= (int) $m['minute'] && 59 >= (int) $m['minute'] ) ) { return TRUE; } return false; } Let me know. I optimized it a li

Re: [PHP] regexp novice

2012-05-17 Thread Jim Lucas
On 5/17/2012 8:07 PM, Jim Giner wrote: "Jim Lucas" 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 Ginerwrote: ok - finally had to come up with my own regexp - and am failing. Trying to validate an input of a time

Re: [PHP] regexp novice

2012-05-17 Thread Jim Giner
"Jim Lucas" 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 >> Ginerwrote: >> >>> 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 Lucas
On 5/17/2012 1:57 PM, shiplu wrote: On Fri, May 18, 2012 at 2:37 AM, Jim Ginerwrote: 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 h

Re: [PHP] regexp novice

2012-05-17 Thread Jim Giner
Thank you ! "Govinda" 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 pattern (needle) in the

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

Re: [PHP] regexp novice

2012-05-17 Thread Jim Giner
"Yared Hufkens" 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 regex

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 h

Re: [PHP] regexp novice

2012-05-17 Thread shiplu
On Fri, May 18, 2012 at 2:37 AM, Jim Giner 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 hour format. My prob

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 wrote: > On 15 October 2010 15:45, Andrew Ballard wrote: >> On Fri, Oct 15, 2010 at 5:52 AM, Richard Quadling >> wrote: >>> On 15 October 2010 10:16, Ford, Mike wrote: > -Original Message- > From: Andre Polykanine [mailto:an...

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

2010-10-15 Thread Richard Quadling
On 15 October 2010 15:45, Andrew Ballard wrote: > On Fri, Oct 15, 2010 at 5:52 AM, Richard Quadling wrote: >> On 15 October 2010 10:16, Ford, Mike wrote: -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: 14 October 2010 21:42 Hi everyone, >>

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 wrote: > On 15 October 2010 10:16, Ford, Mike 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 lo

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

2010-10-15 Thread Richard Quadling
On 15 October 2010 10:16, Ford, Mike 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 regexp that

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: [PHP] RegExp question: how to add a number?

2010-10-14 Thread Richard Quadling
On 14 October 2010 21:42, Andre Polykanine 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 it do

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 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 extract the nu

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 > ('a:3:{s:12:"F1";s:6:"nombre";s:11:"F2";s:5:"F3"

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 >

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`

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-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

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.co

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 > > > > S

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

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] > &

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 >

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>\( href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st > word.*?(.*)Word2:<\/a><\/h4>(.*)Second > word:<\/a><\/h4>(.*)Word3:<\/a><\/h4>(.*)rd

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 > >

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

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>\( href=\"http:\/\/www.thiswebsite.com\/some-script.php\">fir.*?st > word.*?(.*)Word2:<\/a><\/h4>(.*)Second > word:<\/

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>\(fir.*?st word.*?(.*)Word2:<\/a><\/h4>(.*)Second word:<\/a><\/h4>(.*)Word3:<\/a><\/h4>(.*)rd word/is Thanks. I.Lopez. >> On 05/11/2010 09:56 AM, Spud. Ivan. wrote: > > But it

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 unsub

RE: [PHP] regexp questions

2010-05-11 Thread Spud. Ivan.
4.3.0 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:2

RE: [PHP] regexp questions

2010-05-11 Thread Ford, Mike
> -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 questions > > > Is there any place where to read the changelog or something? Um, you mean, like,

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 ___

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 distinguis

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, 201

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 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 Steve

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
ard Lynch [mailto:[EMAIL PROTECTED] Sent: Saturday, December 16, 2006 3:55 AM To: WeberSites LTD Cc: php-general@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 : >

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 th

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 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 summat

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 Weber Sites LTD
Thanks, But this example seems to be short and does the job : Unless I'm missing something? thanks -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Saturday, April 29, 2006 10:29 AM To: Weber Sites LTD Cc: php-general@lists.php.net Subject: Re: [PHP] RegEx

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 " " t

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 wa

RE: [PHP] RegExp for preg_split()

2006-04-28 Thread Weber Sites LTD
tes LTD; php-general@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

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 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']))

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']); if($_REQU

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 express

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 i

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 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 it

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. > > Hi! Why don't you use 'preg_match'? And why do you use all those character classes? This: $subject = 'Nov 22 06:51:36'; $pattern = '/^(\w{3})\s(\d{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 s

[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: --- http://www.php.net/index.php> key=value "; echo 'Normal HTML:'; echo $html; echo ""; $improved_html = preg_

[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
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: --- http://www.php.net/index.php> key=value "; echo 'Normal HTML:'; echo $html;

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: --- style='font-size:12.0pt;font-family:"Comic Sans MS"'>  you realise that that HTML ammounts the to the display of a SINGLE space!!! that what I call progress... 144+ bytes to displ

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

2005-03-10 Thread Eli
Sorry for the spam.. here it is: function tag_rep($tag) { return preg_replace('/(? } $html="http://www.php.net/index.php> key=value "; $improved_html=preg_replace('/\<(.*)\>/Ue','"<".tag_rep("\1").">"',$html); echo str_replace("\\'","'",$improved_html); ?> :) -- PHP General Mailing List (htt

[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: function tag_rep($tag) { return reg_replace('/(? } $html="http://www.php.net/index.php> key=value "; $improved_html=preg_replace('/\<(.*)\>/Ue','"<".tag_rep("\1").">"',$html); echo str_replace("\'","'",$improved_html); ?> -- PHP

[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

[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

[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 un

[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: ---   --- It laks some quotemarks. I want to change it to: ---   --- So it will have " around the attribute values... But i can't figure out how to do that :(. Can anyone help me with this?? Thx in

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 list

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 ) but some more advanced pattern matching is not. I haven't changed the code, but the php-version

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 te

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

2004-10-20 Thread John Holmes
> From: "Chris Boget" <[EMAIL PROTECTED]> > Subject: [PHP] Regexp help > > What would the regex look like to accept *any* character > for a value but the total length of the value can be no greater > than 50 characters. The regex I am trying to use is as follows > > ^[\d\D\w\W\s\S.]{0,50}$ > >

Re: [PHP] Regexp hyperlink

2004-04-19 Thread Martin Visser
Thanks alot! It's indeed an ingenious way of doing it! Martin Richard Harb schreef: A while ago I've been looking at some piece of code of the tikiwiki project to see how they did some of their magic... Basically they run through the whole text and if they found something that was translated th

Re: [PHP] Regexp hyperlink

2004-04-18 Thread Richard Harb
A while ago I've been looking at some piece of code of the tikiwiki project to see how they did some of their magic... Basically they run through the whole text and if they found something that was translated they made a hash and replaced the actual text with it and stored the link in an assoc arr

Re: [PHP] RegExp (preg) - how to split long string to length,wit

2004-04-16 Thread moondog
nice! (things are often under my nose, still I can't see them...I was using explode and loops...) thx moondog Mike Ford wrote: On 16 April 2004 11:47, moondog wrote: Hi, I am a RegExp newbie, and need help with this: i have a long string (500 / 600 chars), and need to split it in lines. Each l

RE: [PHP] RegExp (preg) - how to split long string to length,wit hout cutting words

2004-04-16 Thread Ford, Mike [LSS]
On 16 April 2004 11:47, moondog wrote: > Hi, > I am a RegExp newbie, and need help with this: > i have a long string (500 / 600 chars), and need to split it in lines. > > Each line has a maximum length (20), and words in the line > shouldn't be > cut, instead the line should end at the end of t

Re: [PHP] Regexp Oddity

2004-03-11 Thread trlists
On 11 Mar 2004 Raditha Dissanayake wrote: > print "Matches: " . preg_match('/((?i)rah)\s+\1/', "RAH RAH") . "\n"; > print "Matches: " . preg_match('/((?i)rah)\s+\1/', "rah rah") . > > > is what you should use. Oh. Of course -- I knew it was obvious! This also works: pr

Re: [PHP] Regexp Oddity

2004-03-10 Thread Raditha Dissanayake
print "Matches: " . preg_match('/((?i)rah)\s+\1/', "RAH RAH") . "\n"; print "Matches: " . preg_match('/((?i)rah)\s+\1/', "rah rah") . is what you should use. [EMAIL PROTECTED] wrote: I must be missing something obvious ... I am trying to use backreferences in a PCRE regexp to check for a r

Re: [PHP] regexp appears to be faulty!?

2004-02-25 Thread Henry Grech-Cini
Absolutely brilliant, also I'm using the /s modifier to process newlines as well. Great Thanks to everybody for their help. "Jome" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > "Henry Grech-Cini" <[EMAIL PROTECTED]> skrev i meddelandet > news:[EMAIL PROTECTED] > > Thanks for th

Re: [PHP] regexp appears to be faulty!?

2004-02-24 Thread Jome
"Henry Grech-Cini" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > Thanks for that Mike, > > I was getting lost. > > Is there anyway to say > > Any characters excluding the sequence > > so I could do something like > > /]*)>(.* whilst not <\/fieldset>)<\/fieldset>/i > > Or altern

Re: [PHP] regexp appears to be faulty!?

2004-02-24 Thread Henry Grech-Cini
Thanks for that Mike, I was getting lost. Is there anyway to say Any characters excluding the sequence so I could do something like /]*)>(.* whilst not <\/fieldset>)<\/fieldset>/i Or alternatively is there a switch to say get the smallest sequence Thanks Henry "Mike Ford" <[EMAIL PROTECTE

RE: [PHP] regexp appears to be faulty!?

2004-02-24 Thread Ford, Mike [LSS]
On 24 February 2004 12:40, Henry Grech-Cini wrote: > Hi All, > > function extractFieldsets($subject) > { >$regexp="/]*)>[^(<\/fieldset>)]*/i"; This: [^(<\/fieldset>)] will match any *single* character except the ones listed -- i.e. any character that isn't one of: ()<>/defilst So this: [^(

Re: [PHP] Regexp help (simple)

2004-01-22 Thread Martin Luethi
maybe this work: replace the special-characters first, eg.: $bokid = str_replace("å", "_", $bokid); and replace them back after preg_match or try the preg_match with the hexcode of this special chars: \xhh character with hex code hh (http://ch2.php.net/manual/de/pcre.pattern.syntax.php) g. martin

Re: [PHP] Regexp help (simple)

2004-01-22 Thread Victor Spång Arthursson
2004-01-22 kl. 10.40 skrev Dagfinn Reiersøl: I assume you mean: $test = split_bokid("ääö12345"); Yes! I don't know. It works fine on my computer. The letters display correctly on the command line and even in Mozilla. Hmmm… try the following:

  1   2   >