Re: [PHP] Problem with RegEx for BBCode

2010-11-28 Thread Richard Quadling
On 27 November 2010 13:57, Asmann, Roland wrote: > Hi all, > > I am playing around with PHP and BBCodes and have found some regex's > that should transform my BBCode into correct HTML when rendering. > However, I have found that if the BBCode is not correct (eg missing > closing tag), the regex co

Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Asmann, Roland
Sorry people for not replying over the list... On 27-11-10 20:08, Daniel P. Brown wrote: > On Sat, Nov 27, 2010 at 14:05, Daniel P. Brown > wrote: > > On Sat, Nov 27, 2010 at 13:55, Asmann, Roland > wrote: > >> > >> $s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "\\1", $s); > > > >This i

Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 14:05, Daniel P. Brown wrote: > On Sat, Nov 27, 2010 at 13:55, Asmann, Roland wrote: >> >> $s = preg_replace("/\[i\]((\s|.)+?)\[\/i\]/", "\\1", $s); > >    This is exactly what I meant when I erroneously said, "library." Without seeing the rest of your code, try adjus

Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Daniel P. Brown
Please be sure to hit Reply-All so that the list is CC'd on each response as well. On Sat, Nov 27, 2010 at 13:55, Asmann, Roland wrote: > > I'm currently running this on a default XAMPP installation on my PC, > because I was told something similar is running on the server. I thought > this ha

Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 12:50, Asmann, Roland wrote: > > Besides, what I don't really understand is WHY does this happen? Any > other language that has RegEx doesn't match a thing in my example and > just returns the original input. Why is PHP different in this regard? All we've seen is your

Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Asmann, Roland
On 27-11-10 18:44, Asmann, Roland wrote: > On 27-11-10 17:24, Daniel P. Brown wrote: > > On Sat, Nov 27, 2010 at 08:57, Asmann, Roland > > wrote: > > > Hi all, > > > > > > I am playing around with PHP and BBCodes and have found some regex's > > > that should transform my BBCode into correct

Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Asmann, Roland
On 27-11-10 17:24, Daniel P. Brown wrote: > On Sat, Nov 27, 2010 at 08:57, Asmann, Roland > wrote: > > Hi all, > > > > I am playing around with PHP and BBCodes and have found some regex's > > that should transform my BBCode into correct HTML when rendering. > > However, I have found that if t

Re: [PHP] Problem with RegEx for BBCode

2010-11-27 Thread Daniel P. Brown
On Sat, Nov 27, 2010 at 08:57, Asmann, Roland wrote: > Hi all, > > I am playing around with PHP and BBCodes and have found some regex's > that should transform my BBCode into correct HTML when rendering. > However, I have found that if the BBCode is not correct (eg missing > closing tag), the rege

[PHP] Problem with RegEx for BBCode

2010-11-27 Thread Asmann, Roland
Hi all, I am playing around with PHP and BBCodes and have found some regex's that should transform my BBCode into correct HTML when rendering. However, I have found that if the BBCode is not correct (eg missing closing tag), the regex completely eats my input and my page is empty! The regex I'

[PHP] Problem with regex

2001-09-25 Thread Oliver Ertl
Hi, The following works. But I wouldn't allow users to use something like -. --- _- in $TestPwd. How can I implement this ? --- Steve Edberg <[EMAIL PROTECTED]> wrote: > if (ereg('^[a-z][-a-z0-9\._]*[a-z]$', $TestPwd)) { > echo "Good"; > } else { > echo "Bad password $TestPwd"; > }

Re: [PHP] Problem with regex

2001-09-25 Thread Steve Edberg
if (ereg('^[a-z][-a-z0-9\._]*[a-z]$', $TestPwd)) { echo "Good"; } else { echo "Bad password $TestPwd"; } should do it. If you want a case insensitive match, use eregi(...) instead. The above regexp allows passwords as short as 2 characters. If you want to, for example, enforce

[PHP] Problem with regex

2001-09-24 Thread Oliver Ertl
Hi, I need a regex for a username validation. The ereg function should be used. o the username must start and end with a-z o in the middle it could be a-z0-9\.-_ o and never something like this -- -. _- and so on Thanks for your help Oliver = mailto: [EMAIL PROTECTED] www.ertl.co.za