[PHP] Re: Regular expressions (regex) question for parsing
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 $finaltext -- bad data (missing ending) 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 those lines too. so that I end up with an array like: $result = array (matches = array (0 = $sometext %\r\n, 1 = $otherstring %\r\n, 2 = $andyetmoretext %\r\n ), non_matches = array (3 = $finaltext ) ); The key thing here is that the line numbers are preserved and the non-matched lines are saved... Any ideas, what's the best way to go about this? Preg_matc, preg_split or something incorporating explode? Rene Where does the text come from, a text file? client-side textarea? DB? etc.? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions question
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. I tried eregi('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. Thank you - Never miss a thing. Make Yahoo your homepage. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions question
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('[a-z]', $fname) but this allows the user to enter abdg4512kdkdk for example. Thank you - Never miss a thing. Make Yahoo your homepage. Keeping with your example, this works and doesn't allow an empty string (to allow empty, replace the + with *): eregi('^[a-z]+$', $fname) -or- ereg('^[A-Za-z]+$', $fname) But ctype_alpha() is a better multi-locale solution. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions
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 working on: [desc] = c FF topic c 99 rest of the text , $string = preg_replace(/c\s\w[0-9A-F]+/,,$string); prints out: topic rest of the text ( with double spaces :(, I thought \s would fix that ) however how would I go on this: font color=colorcodetopic/font font color=colorcoderest of thetext/font Almost anything I do with the above statement either throws me off with a modifier error or prints out what it should not --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: regular expressions
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 right now. =) also thanks. Børge Holen wrote: Ok I seem to need to learn regular expressions more than anything. this is what im working on: [desc] = c FF topic c 99 rest of the text , $string = preg_replace(/c\s\w[0-9A-F]+/,,$string); prints out: topic rest of the text ( with double spaces :(, I thought \s would fix that ) however how would I go on this: font color=colorcodetopic/font font color=colorcoderest of thetext/font Almost anything I do with the above statement either throws me off with a modifier error or prints out what it should not --- Børge Kennel Arivene http://www.arivene.net --- -- --- Børge Kennel Arivene http://www.arivene.net --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions and Phone validation
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 expressions. Well, I'm not sure about what you don't understand. Anyway, preg_replace() does the same as str_replace(), but using regular-expressions instead of just strings. If you understand how do reg-exp work, then it should have no real problem, if the reg-exp are the problem then you better read a little more about them (the PCRE tutorial at php.net is really good, IMHO) Here is the function in use: function checkPhone ($Phone) [···] $Phone = ereg_replace([^0-9], '', $Phone); if ((strlen($Phone)) = 14) return preg_replace(/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]{4}).*/, (\\1) \\2-\\3, $Phone); [···] I think my problem is mostly what is returned when preg_replace executes? Well, what's inside parenthesis is remembered by preg_replace(), and you make reference to them using \\n or $n (where n is a number) in the replace-string (there are some exceptions, but that should do for now) If you look carefuly, there are three expressions between parenthesis, and these are what you're referencing via (\\1) \\2-\\3 Though, there's something I don't get it: in your reg-exp your ignoring any non-numeric character, but you already got rid of them with ereg_replace()... (??) -- Atentamente, J. Rafael Salazar Magaña Innox - Innovación Inteligente Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE http://www.innox.com.mx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular expressions problem
* 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| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
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/ -- Tim Van Wassenhove http://home.mysth.be/~timvw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
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 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
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 of the next line ! Tim Van Wassenhove wrote: 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
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 http://home.mysth.be/~timvw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions
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: http://www.php.net/unsub.php
[PHP] Re: regular expressions
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=glances=books Ben Ramsey wrote: 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: http://www.php.net/unsub.php
[PHP] Re: Regular expressions
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 include it in the replace. The way I have it now check for all the letters in live instead of the whole string. I hope I explained this properly. $text = ereg_replace ((live/)?content\.php\?[]*Item_ID=([0-9]*)Start=([0-9]*)Category_ID=([0-9]*)[]*, content\\1start\\2CID\\3.php, $text); The (live/)? should catch zero or one occurence of live/. Maybe the regex library in your PHP doesn't know about ?, than you could use * instead - consider using the PCRE preg_replace function. Regards... Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions
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 change the capital I to small l, but only in the beginning of a word. How is this done in regular expression ? Any help appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions Help
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 = (http://)?([^[:space:]]+)([[:alnum:]\.-_?/=]); You've already gotten a working substitute using the superior preg_replace function, but FWIW: the invalid range was caused by a misplaced hyphen. In the middle of a character class, it delimits a range; to use it as a literal, make it the last character in the character class. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions help please
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. snip more examples First you need to decide what you mean by word. If it's simply the stuff separated by a space, then you might find it simpler to explode your sentences on the space character, then loop through the resulting array using string functions to do your comparisons . Regex is great for the power and flexibility it offers, but if you're really struggling with the syntax, using constructs that are more familiar may help you move forward. On the other hand, it's frequently the case that one needs a more sophisticated definition of word. Is it just adjacent letters? What if they're interrupted by a hyphen? Are leading/trailing punctuation marks included? Do adjacent digits count as words? Etc. Once you've defined the pattern comprising a word, you can then translate it into regex--or get more help from others in making the translation. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions: HUGE speed differences
On Sat, 06 Apr 2002 15:01:24 +0300, Ando [EMAIL PROTECTED] wrote: (eregi((frame[^]*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 expressions would simplify your code significantly. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regular expressions
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. In php 4.0.5 i use this if ( ereg(([0-9][0-9]*)\|(\w\w*),$opcion, $registros) ) { ... } and no problem. But, in php 4.1.1 don't work. I think that may be the escape of | character. Note: I'm looking for a | in the string. Then i need escape the | Any idea for fix it? Thanks German Castro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: regular expressions
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: regular expressions 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. In php 4.0.5 i use this if ( ereg(([0-9][0-9]*)\|(\w\w*),$opcion, $registros) ) { ... } and no problem. But, in php 4.1.1 don't work. I think that may be the escape of | character. Note: I'm looking for a | in the string. Then i need escape the | Any idea for fix it? Thanks German Castro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: regular expressions
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 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: regular expressions 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. In php 4.0.5 i use this if ( ereg(([0-9][0-9]*)\|(\w\w*),$opcion, $registros) ) { ... } and no problem. But, in php 4.1.1 don't work. I think that may be the escape of | character. Note: I'm looking for a | in the string. Then i need escape the | Any idea for fix it? Thanks German Castro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Regular Expressions - A relatively simple search...
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, $dotpos); with a simpler regular expression: $extension = eregi_replace( /.*, , $userfile_name); However it isn't working.. What I'd like to do is to find the extension of a file name and place that in a variable. So in '/home/mike/test.txt', I want to have the statement return 'txt' you don't need a regular expression for that... $extension = strrchr(basename($userfile_name), '.'); -robin -- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Abolish Nuclear Weapons Now!: http://pgs.ca/petition/ It is a miracle that curiosity survives formal education. - A Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Regular Expressions - A relatively simple search...
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]... 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 = eregi_replace( /.*, , $userfile_name); However it isn't working.. What I'd like to do is to find the extension of a file name and place that in a variable. So in '/home/mike/test.txt', I want to have the statement return 'txt' Any help would be appreciated.. Mike -- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Abolish Nuclear Weapons Now!: http://pgs.ca/petition/ It is a miracle that curiosity survives formal education. - A Einstein -- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Abolish Nuclear Weapons Now!: http://pgs.ca/petition/ It is a miracle that curiosity survives formal education. - A Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Regular Expressions - A relatively simple search...
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, 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 = eregi_replace( /.*, , $userfile_name); However it isn't working.. What I'd like to do is to find the extension of a file name and place that in a variable. So in '/home/mike/test.txt', I want to have the statement return 'txt' you don't need a regular expression for that... $extension = strrchr(basename($userfile_name), '.'); -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Regular Expressions - A relatively simple search...
? $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]... 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 = eregi_replace( /.*, , $userfile_name); However it isn't working.. What I'd like to do is to find the extension of a file name and place that in a variable. So in '/home/mike/test.txt', I want to have the statement return 'txt' Any help would be appreciated.. Mike -- Mike Gifford, OpenConcept Consulting, http://openconcept.ca Offering everything your organization needs for an effective web site. Abolish Nuclear Weapons Now!: http://pgs.ca/petition/ It is a miracle that curiosity survives formal education. - A Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Regular Expressions - A relatively simple search...
[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 = eregi_replace( /.*, , $userfile_name); However it isn't working.. What I'd like to do is to find the extension of a file name and place that in a variable. So in '/home/mike/test.txt', I want to have the statement return 'txt' you don't need a regular expression for that... $extension = strrchr(basename($userfile_name), '.'); -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Regular expressions
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 - From: Philip Murray [EMAIL PROTECTED] Newsgroups: php.general To: PHP General List [EMAIL PROTECTED] Sent: Wednesday, July 18, 2001 12:31 AM Subject: Regular expressions 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, f, $foo); in PHP. Is there a more elegant way of doing this in PHP? I tried preg_replace but it didn't seem to like my regexp. Any ideas? - -- - - - Philip Murray [EMAIL PROTECTED] - - -- - - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Regular expressions
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, f, $foo); in PHP. Is there a more elegant way of doing this in PHP? See the docs on str_replace() or preg_replace, both of which can take arrays as arguments, or on strtr() which appears to be the most direct equivalent to your Perl expression. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Regular Expressions?
(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 Expressions (from what I could gather from PHP.net and Core PHP Programming by Leon Atkinson.) I want to match any of the following: 1.1 or a.a or . or .-- any number of digits (0-9) or alpha (a-z) on either side of the dot. if(eregi("^([0-9][a-z]\.[0-9][a-z]", $myArray[x])) Is this correct? I think I'm missing something. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]