[PHP] Re: Regular expressions (regex) question for parsing

2008-12-22 Thread Al
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 $fina

[PHP] Re: regular expressions question

2008-03-05 Thread Al
ctype_alpha ( string $text ) Adil Drissi 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.

[PHP] Re: regular expressions question

2008-03-04 Thread Shawn McKenzie
Adil Drissi 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. > > I tried eregi('[

Re: [PHP] Re: regular expressions

2006-11-19 Thread Børge Holen
On Sunday 19 November 2006 23:25, Al wrote: > Get "Sams, Teach yourself Regular Expressions" It's a great little, simple > book. I'll look that one up. Thank you =) > > Then get the Regex Coach. Google to find it. It's free, works great and is > super for learning regex And this one, I'm on rig

[PHP] Re: regular expressions

2006-11-19 Thread Al
Get "Sams, Teach yourself Regular Expressions" It's a great little, simple book. Then get the Regex Coach. Google to find it. It's free, works great and is super for learning regex Børge Holen wrote: Ok I seem to need to learn regular expressions more than anything. this is what im workin

[PHP] Re: regular expressions and Phone validation

2006-03-15 Thread Rafael
Paul Goepfert wrote: 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

[PHP] Re: Regular expressions problem

2005-04-29 Thread Matthew Weier O'Phinney
* Khorosh Irani <[EMAIL PROTECTED]>: > Hello > I have a question: > What is in the role of space in the regular expressions (POSIX)? To match a space. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| ht

[PHP] Re: Regular Expressions

2004-07-15 Thread Tim Van Wassenhove
In article <[EMAIL PROTECTED]>, Red Wingate wrote: > Oh guess it would be even better and faster to only use: > > /Last Name:([^\n]*)/ In most environments is strpos and substr even faster ;) -- Tim Van Wassenhove -- PHP General Mailing List (http://www.php.net/)

[PHP] Re: Regular Expressions

2004-07-15 Thread Red Wingate
Oh guess it would be even better and faster to only use: /Last Name:([^\n]*)/ and trim() the result :-) -- red Red Wingate wrote: Yep, but to avoid his problem with empty Strings he should use something like: /Last Name: *(.*?)\n/ outerwise \s* will match the first newline and continue to the end

[PHP] Re: Regular Expressions

2004-07-15 Thread Red Wingate
Yep, but to avoid his problem with empty Strings he should use something like: /Last Name: *(.*?)\n/ outerwise \s* will match the first newline and continue to the end of the next line ! Tim Van Wassenhove wrote: In article <[EMAIL PROTECTED]>, Arik Raffael Funke wrote: implement following pattern

[PHP] Re: Regular Expressions

2004-07-15 Thread Tim Van Wassenhove
In article <[EMAIL PROTECTED]>, Arik Raffael Funke wrote: > implement following pattern "Last Name:\s*(.*)\n". > I get just 'Jason'. But what I currently get is: > Jason > Street: abc This is behaviour because (.*) is greedy. As you noticed, it matched "Jason \nStreet:abc" /Last Name:\s+(.*?)\n/

[PHP] Re: regular expressions

2004-02-17 Thread Ben Ramsey
I also forgot to mention this book, which I've never used, but I picked it up once and it seemed very helpful: Regular Expression Pocket Reference published by O'Reilly http://www.amazon.com/exec/obidos/tg/detail/-/059600415X/qid=1077025752/sr=1-2/ref=sr_1_2/102-1251244-5472167?v=glance&s=books B

[PHP] Re: regular expressions

2004-02-17 Thread Ben Ramsey
I've always found the PHP manual to be very helpful: http://www.php.net/manual/en/pcre.pattern.syntax.php Pete M wrote: Getting completely confused how this stuff works !!! Anyone recommend a book for a regex newbie ? pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: h

[PHP] Re: Regular expressions

2003-10-24 Thread Michael Mauch
Fernando Melo wrote: > I have the following statement: > > $text = ereg_replace > ("[live/]*content\.php\?[&]*Item_ID=([0-9]*)&Start=([0-9]*)&Category_ID=([0- > 9]*)[&]*", "content\\1start\\2CID\\3.php", $text); > > Basically what I'm trying to do is if the URL includes "live/" then I want > to

[PHP] Re: Regular Expressions

2003-10-16 Thread Manuel Vázquez Acosta
Um! This is like an OCR error. Maybe you'll need a dictionary and craft a soundex/diffin' scheme. I don't think regexp will solve this problem nicely. Manu. "Shmuel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have a misspelled sentence like this: "I am not aIone". > I want to

[PHP] Re: Regular Expressions Help

2002-06-05 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (J. Younker) wrote: > Hi, > I'm trying to use eregi_replace to check a user-submitted URL, but I > keep getting the following error message: > Warning: Invalid range end in /var/www/html/_db_db/db_input.php > This what I'm using: > $pattern = "(h

[PHP] Re: regular expressions help please

2002-04-30 Thread liljim
Hi Ed, first example has been covered by others, so onto the next: > Pulling a word between two other words without having to know what the word > is. For example, pulling whatever word displays between "the" and > "sky". If the string was "the blue sky", the result would be the word > blue.

[PHP] Re: regular expressions help please

2002-04-30 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Ed Lazor) wrote: > I've been banging my head against regular expressions all night... help > would be greatly appreciated. Could you give me examples on how to do the > following? > > Pull everything except a specific word from a sentence.

[PHP] Re: regular expressions: HUGE speed differences

2002-04-06 Thread Chris Adams
On Sat, 06 Apr 2002 15:01:24 +0300, Ando <[EMAIL PROTECTED]> wrote: > (eregi("(]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\"]refresh['\"] You might want to try using preg_match instead. The PCRE engine should be significantly faster. You might also find the ability to pass an array of expr

RE: [PHP] Re: regular expressions

2002-02-21 Thread Douglas Maclaine-cross
Use single quotes? I think that stops it from interpreting the regular expression before hand. -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Friday, February 22, 2002 10:32 To: [EMAIL PROTECTED] Subject: RE: [PHP] Re: regular expressions yeah! remember that

RE: [PHP] Re: regular expressions

2002-02-21 Thread Martin Towell
yeah! remember that php interprets the string first, before it gets to reg.ex. !! That's some I keep forgetting... lol Martin -Original Message- From: Murray Chamberlain [mailto:[EMAIL PROTECTED]] Sent: Friday, February 22, 2002 2:48 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: re

[PHP] Re: regular expressions

2002-02-21 Thread Murray Chamberlain
I think you have some un-needed code there. But anyway you might need to use a double backslash infront of the | If that doesn't work mail me back Muz "German Castro Donoso" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a problem with ereg function.

Re: [PHP] Re: Regular Expressions - A relatively simple search...

2001-09-09 Thread Sterling Hughes
On Mon, 10 Sep 2001, Mike Gifford wrote: > Thanks robin, this is very useful! > yep, although pathinfo() is much easier: $extension = pathinfo($userfile_name, PATHINFO_EXTENSION); -Sterling > Robin Vickery wrote: > > [EMAIL PROTECTED] (Mike Gifford) writes: > > > > > >>Hello, > >>

[PHP] Re: Regular Expressions - A relatively simple search...

2001-09-09 Thread Mike Gifford
Thanks.. _lallous wrote: > $str = "/home/mike/test.txt"; > if (preg_match("/[^\.]+$/", $str, $matches)) > $ext = $matches[0]; > else > $ext = "no extension"; > echo "extension=$ext"; > ?> > > "Mike Gifford" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

[PHP] Re: Regular Expressions - A relatively simple search...

2001-09-09 Thread Mike Gifford
Thanks robin, this is very useful! Robin Vickery wrote: > [EMAIL PROTECTED] (Mike Gifford) writes: > > >>Hello, >> >>I'm trying to replace a couple of lines of code: >> >> $dotpos = 1 - (strlen($userfile_name) - strpos($userfile_name, '.')); >> $extension = substr($userfile_name, $dot

[PHP] Re: Regular Expressions - A relatively simple search...

2001-09-07 Thread Robin Vickery
[EMAIL PROTECTED] (Mike Gifford) writes: > Hello, > > I'm trying to replace a couple of lines of code: > > $dotpos = 1 - (strlen($userfile_name) - strpos($userfile_name, '.')); > $extension = substr($userfile_name, $dotpos); > > with a simpler regular expression: > $extension

[PHP] Re: Regular Expressions - A relatively simple search...

2001-09-07 Thread _lallous
"Mike Gifford" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I'm trying to replace a couple of lines of code: > > $dotpos = 1 - (strlen($userfile_name) - strpos($userfile_name, '.')); > $extension = substr($userfile_name, $dotpos); > > with a simp

[PHP] Re: Regular expressions

2001-07-31 Thread Richard Lynch
Your three str_replace calls might be faster anyway... -- WARNING [EMAIL PROTECTED] address is an endangered species -- Use [EMAIL PROTECTED] Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm - Original Message

[PHP] Re: Regular expressions

2001-07-18 Thread CC Zona
In article <000b01c10f4a$d569c5c0$0300a8c0@sparlak>, [EMAIL PROTECTED] (Philip Murray) wrote: > In Perl you can do this: > > $foo =~ tr/012/mpf/; > > Which is the same as: > > $foo = str_replace("0", "m", $foo); > $foo = str_replace("1", "p", $foo); > $foo = str_replace("2", "

Re: [PHP] Re: Regular Expressions?

2001-04-20 Thread CC Zona
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("yanto") wrote: > (eregi("([0-9][a-z][A-Z]\.[0-9][a-z][A-Z]", $myArray[x])) > > and don't use character '^' in front of the pattern. (Note that since the parentheses are unbalanced, the above will thorw a parse error.) Since it's eregi, you

[PHP] Re: Regular Expressions?

2001-04-19 Thread yanto
(eregi("([0-9][a-z][A-Z]\.[0-9][a-z][A-Z]", $myArray[x])) and don't use character '^' in front of the pattern. -toto- Jason Caldwell writes: > I'm looking to compare if my array values match any digits or alpha > characters with a dot between them... so, if I think I understand Regular > Expr