Re: [PHP] The difference between ereg and preg? [SOLVED]
Robert, Thank you for pointing me to the relevant part of TFM that I needed to R. The final regular expression that I have settled on that is reliably producing expected results is: #(.*)#isU" This finds all the text between a and tag. I found that it was helpful for me to restrict the the tags down to simple constructs, instead of having "]*>", because in the source I'm using, the and tags never have additional parameters. Having a more flexible definition was causing confusion with a tag elsewhere in the source. Anyway, the point is that it works very well now. Thanks to the PHP list, especially Jochem, Ligaya, Dave, Robert, Mike, Robert, Adam, and John, for all your helpful information and advice. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
On Sun, 2006-08-06 at 10:39 +0900, Dave M G wrote: > Robert, > > Thank you for replying. > > > > Check out the greediness modifier. Greediness determines whether it > > extends the matching to the largest possible match or the smallest > > possible match. By default regexes are greedy. > > By "greediness modifier", do you mean the preg_set_match, the > preg_set_order, and preg_pattern_order arguments? > > The documentation on the PHP site does mention the term "greedy", but to > me it's not very clear about explaining which modifiers are responsible > for which behaviour. > > I've experimented with each, and to me it seems like they all behave the > same, so perhaps "greediness" is determined by some other modifier? RTFM ;) http://ca.php.net/manual/en/reference.pcre.pattern.modifiers.php Search for greedy or more specifically ungreedy :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Robert, Thank you for replying. Check out the greediness modifier. Greediness determines whether it extends the matching to the largest possible match or the smallest possible match. By default regexes are greedy. By "greediness modifier", do you mean the preg_set_match, the preg_set_order, and preg_pattern_order arguments? The documentation on the PHP site does mention the term "greedy", but to me it's not very clear about explaining which modifiers are responsible for which behaviour. I've experimented with each, and to me it seems like they all behave the same, so perhaps "greediness" is determined by some other modifier? -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
On Sat, 2006-08-05 at 10:50 +0900, Dave M G wrote: > Jochem > > Thank you for your continued assistance. > > > ^--- remove the caret as you dont want to only match when the line > > starts with (the can be anywhere on the line) > > > Ah, I get it now. I was confused about the meaning of the caret. > > > I'll assume you also have the mb extension setup. > > > Yes, I do. > > This regular expression is tricky stuff, and its behaviour is not what > I'd expect. > > After much experimentation, I discovered that I needed to take the last > "s" out of my syntax. This was the "s" that states that the search could > span across line breaks. > > I assumed that the behaviour would be to start at one instance of > and continue until the first instance of and extract that as a > variable. And then start again at the next instance of and so on. > > But instead it seems to be starting from the extreme outside and work > it's way inwards from both ends, thus trapping all text between the very > first in the source string, and the very last in the source. > > So if the "s" option is on to span across lines, then it gets only one > match for the whole HTML document, containing everything between the > very first and the very last . If I take off the "s" option, > then it only looks at and tags within each line, thus > returning small, discreet matches. Check out the greediness modifier. Greediness determines whether it extends the matching to the largest possible match or the smallest possible match. By default regexes are greedy. > I personally don't think this is very rational behaviour, so either I'm > doing something wrong still, or perhaps it's me who isn't very rational. > Either is likely. It's perfectly valid since it is correctly matching the pattern, just an issue of how greed ;) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Jochem Thank you for your continued assistance. ^--- remove the caret as you dont want to only match when the line starts with (the can be anywhere on the line) Ah, I get it now. I was confused about the meaning of the caret. I'll assume you also have the mb extension setup. Yes, I do. This regular expression is tricky stuff, and its behaviour is not what I'd expect. After much experimentation, I discovered that I needed to take the last "s" out of my syntax. This was the "s" that states that the search could span across line breaks. I assumed that the behaviour would be to start at one instance of and continue until the first instance of and extract that as a variable. And then start again at the next instance of and so on. But instead it seems to be starting from the extreme outside and work it's way inwards from both ends, thus trapping all text between the very first in the source string, and the very last in the source. So if the "s" option is on to span across lines, then it gets only one match for the whole HTML document, containing everything between the very first and the very last . If I take off the "s" option, then it only looks at and tags within each line, thus returning small, discreet matches. I personally don't think this is very rational behaviour, so either I'm doing something wrong still, or perhaps it's me who isn't very rational. Either is likely. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
On Fri, 2006-08-04 at 13:03 -0400, John Nichel wrote: > > Perl compatible regexs are faster* and more powerful. Course, writing a > good Perl regex is an art form in itself (probably why O'Reilly released > a book just on regexs), and takes some time (and headaches) to master > (if one ever does master it). > > The difference in the people who use one or the other? Probably nothing > more than their background. Those of us who worked with Perl before php > are more than likely gravitate towards preg. Those who didn't, or had > little Perl regex experience more than likely went to the POSIX (ereg) > style as it's a bit easier to pick up. > > *I'm sure there are some out there who will dispute this. I use POSIX primarily because it was a standard and because PCRE was not originally enabled by default. Seems funny that the POSIX version is being deprecated *heh*. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Dave M G wrote: PHP List, Recently I wrote a piece of code to scrape data from an HTML page. Part of that code deleted all the unwanted text from the very top of the page, where it says "of a "" tag. That code looks like this: ereg_replace("", "", $htmlPage); It works fine. But I noticed that on almost all the tutorial pages I looked at, they just about always used preg_replace, and not ereg_replace. It seemed that the main difference was that preg_replace required forward slashes around the regular expression, like so: preg_replace("//", "", $htmlPage); But that didn't work, and returned an error. You need to comment out the '!' Since ereg was working, though, I figured I would just stick with it. Still, I thought it worth asking: Is there any reason why either ereg or preg would be more desirable over the other? Perl compatible regexs are faster* and more powerful. Course, writing a good Perl regex is an art form in itself (probably why O'Reilly released a book just on regexs), and takes some time (and headaches) to master (if one ever does master it). The difference in the people who use one or the other? Probably nothing more than their background. Those of us who worked with Perl before php are more than likely gravitate towards preg. Those who didn't, or had little Perl regex experience more than likely went to the POSIX (ereg) style as it's a bit easier to pick up. *I'm sure there are some out there who will dispute this. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Dave M G wrote: > Jochem, > > Thank you for responding, and for explaining more about regular > expressions. > >> yes but you wouldn't use preg_replace() but rather preg_match() or >> preg_match_all() >> which gives you back an array (via 3rd/4th[?] reference argument) >> which contains >> the texts that matched (and therefore want to keep). > I looked up preg_match_all() on php.net, and, in combination with what > was said before, came up with this syntax: > > preg_match_all( "#^]*>(.*)]*>#is", $response, $wordList, ^--- remove the caret as you dont want to only match when the line starts with (the can be anywhere on the line) I'll assume you also have the mb extension setup. > PREG_PATTERN_ORDER ); > var_dump($wordList); > > The idea is to catch all text between and tags. > > Unfortunately, the result I get from var_dump is: > > array(2) { [0]=> array(0) { } [1]=> array(0) { } } > > In other words, it made no matches. > > The text being searched is an entire web page which contains the following: > (Please note the following includes utf-8 encoded Japanese text. > Apologies if it comes out as ASCII gibberish) > > 日本語は簡単だよ > 日本語 【にほんご】 (n) Japanese language; (P); EP > 簡単 【かんたん】 (adj-na,n) simple; (P); EP > > > So, my preg_match_all search should have found: > > 日本語 【にほんご】 (n) Japanese language; (P); EP > 簡単 【かんたん】 (adj-na,n) simple; (P); EP > > I've checked and rechecked my syntax, and I can't see why it would fail. > > Have I messed up the regular expression, or the use of preg_match_all? > > -- > Dave M G > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Jochem, Thank you for responding, and for explaining more about regular expressions. yes but you wouldn't use preg_replace() but rather preg_match() or preg_match_all() which gives you back an array (via 3rd/4th[?] reference argument) which contains the texts that matched (and therefore want to keep). I looked up preg_match_all() on php.net, and, in combination with what was said before, came up with this syntax: preg_match_all( "#^]*>(.*)]*>#is", $response, $wordList, PREG_PATTERN_ORDER ); var_dump($wordList); The idea is to catch all text between and tags. Unfortunately, the result I get from var_dump is: array(2) { [0]=> array(0) { } [1]=> array(0) { } } In other words, it made no matches. The text being searched is an entire web page which contains the following: (Please note the following includes utf-8 encoded Japanese text. Apologies if it comes out as ASCII gibberish) 日本語は簡単だよ 日本語 【にほんご】 (n) Japanese language; (P); EP 簡単 【かんたん】 (adj-na,n) simple; (P); EP So, my preg_match_all search should have found: 日本語 【にほんご】 (n) Japanese language; (P); EP 簡単 【かんたん】 (adj-na,n) simple; (P); EP I've checked and rechecked my syntax, and I can't see why it would fail. Have I messed up the regular expression, or the use of preg_match_all? -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Ford, Mike wrote: > On 04 August 2006 11:30, Dave M G wrote: > >> Jochem, >> ... > > That's where capturing expressions and backreferences come in handy: > > preg_replace ("/.*(.*).*/", "$1", $htmlPage); > > (add qualifiers and other options to taste, as before!) ah yes, good point - you can do it with preg_replace() (I only mentioned preg_match() (et al) - guess I left my regexp hat at home today. :-) > > Cheers! > > Mike > > - > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Headingley Campus, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 > > > To view the terms under which this email is distributed, please go to > http://disclaimer.leedsmet.ac.uk/email.htm > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Dave M G wrote: > Jochem, > > Thank you for responding. > >> >> does this one work?: >> preg_replace('#^<\!DOCTYPE(.*)]*>#is', '', $htmlPage); > > Yes, that works. I don't think I would have every figured that out on my > own - it's certainly much more complicated than the ereg equivalent. 1. the '^' at the start of the regexp states 'must match start of the string (or line in multiline mode)' 2. the 'i' after the the closing regexp delimiter states 'match case-insensitively' 3. the 's' after the the closing regexp delimiter states 'the dot also matches newlines' 4. the ']*>' matches a UL tag with any number of attributes ... the '[^>]*' matches a number of characters that are not a '>' character - the square brackets denote a character class (in this cass with just one character in it) and the '^' at the start of the character class definition negates the class (i.e. turns the character class definition to mean every character *not* defined in the class) PCRE is alot more powerful [imho], the downside it it has more modifiers and syntax to control the meaning of the patterns... read and become familiar with these 2 pages: http://php.net/manual/en/reference.pcre.pattern.modifiers.php http://php.net/manual/en/reference.pcre.pattern.syntax.php and remember that writing patterns is often quite a complex - when you build one just take i one 'assertion' at a time, ie. build the pattern up step by step... if you give it a good go and get stuck, then there is always the list. > > If I may push for just one more example of how to properly use regular > expressions with preg: > > It occurs to me that I've been assuming that with regular expressions I > could only remove or change specified text. essentially regexps are pattern syntax for asserting where something matches a pattern (or not) - there are various functions that allow you to act upon the results of the pattern matching depending on your needs (see below) > > What if I wanted to get rid of everything *other* than the specified text? > > Can I form an expression that would take $htmlPage and delete everything > *except* text that is between a tag and a tag? yes but you wouldn't use preg_replace() but rather preg_match() or preg_match_all() which gives you back an array (via 3rd/4th[?] reference argument) which contains the texts that matched (and therefore want to keep). > > Or is that something that requires much more than a single use of > preg_replace? > > -- > Dave M G > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] The difference between ereg and preg?
On 04 August 2006 11:30, Dave M G wrote: > Jochem, > > Thank you for responding. > > > > > does this one work?: > > preg_replace('#^<\!DOCTYPE(.*)]*>#is', '', $htmlPage); > > Yes, that works. I don't think I would have every figured > that out on my > own - it's certainly much more complicated than the ereg equivalent. > > If I may push for just one more example of how to properly > use regular > expressions with preg: > > It occurs to me that I've been assuming that with regular expressions > I could only remove or change specified text. > > What if I wanted to get rid of everything *other* than the specified > text? > > Can I form an expression that would take $htmlPage and delete > everything *except* text that is between a tag and a tag? That's where capturing expressions and backreferences come in handy: preg_replace ("/.*(.*).*/", "$1", $htmlPage); (add qualifiers and other options to taste, as before!) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Dave M G wrote: > Chris, Ligaya, Dave, > > Thank you for responding. I understand the difference in principle > between ereg and preg much better now. > > Chris wrote: >> ! in perl regular expressions means "not" so you need to escape it: >> \! > Still, when including that escape character, the following preg > expression does not find any matching text: > preg_replace("/<\!DOCTYPE(.*)/", "", $htmlPage); does this one work?: preg_replace('#^<\!DOCTYPE(.*)]*>#is', '', $htmlPage); > > Whereas this ereg expression does find a match: > ereg_replace("", "", $htmlPage); > > What do I need to do to make the preg expression succeed just as the > ereg expression does? > > Thank you for your time and advice. > > -- > Dave M G > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
On 04/08/06, Dave M G <[EMAIL PROTECTED]> wrote: It seemed that the main difference was that preg_replace required forward slashes around the regular expression, like so: preg_replace("//", "", $htmlPage); It requires delimiters - slashes are conventional, but other characters can be used. But that didn't work, and returned an error. What you've written here shouldn't return you an error - what did the message say? I suspect you were trying to match until rather than and the pcre engine thought the forward slash was the end of your regular expression. Part of that code deleted all the unwanted text from the very top of the page, where it says "" tag. It won't quite do that. The (.*) matches as much as possible (it's called greedy matching) - so it'll match and replace all the way down to the *last* instance of a "" tag. To make it match for the shortest length possible, put a question-mark after the ".*" like so: preg_replace("//", "", $htmlPage); Since ereg was working, though, I figured I would just stick with it. Still, I thought it worth asking: Is there any reason why either ereg or preg would be more desirable over the other? pcre has a performance advantage, has more features and can use the many regexps written for perl with few or no changes. ereg is a posix standard. -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Jochem, Thank you for responding. does this one work?: preg_replace('#^<\!DOCTYPE(.*)]*>#is', '', $htmlPage); Yes, that works. I don't think I would have every figured that out on my own - it's certainly much more complicated than the ereg equivalent. If I may push for just one more example of how to properly use regular expressions with preg: It occurs to me that I've been assuming that with regular expressions I could only remove or change specified text. What if I wanted to get rid of everything *other* than the specified text? Can I form an expression that would take $htmlPage and delete everything *except* text that is between a tag and a tag? Or is that something that requires much more than a single use of preg_replace? -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] The difference between ereg and preg?
On 04 August 2006 10:52, Dave M G wrote: > Chris, Ligaya, Dave, > > Thank you for responding. I understand the difference in principle > between ereg and preg much better now. > > Chris wrote: > > ! in perl regular expressions means "not" so you need to escape it: > > \! AFAIR, that's only true in the (?! assertion sequence. > Still, when including that escape character, the following preg > expression does not find any matching text: > preg_replace("/<\!DOCTYPE(.*)/", "", $htmlPage); > > Whereas this ereg expression does find a match: > ereg_replace("", "", $htmlPage); > > What do I need to do to make the preg expression succeed just as the > ereg expression does? By default, . in preg_* patterns does not match newlines. If you are matching in a multiline string, use the s modifier to change this: preg_replace("//s", "", $htmlPage); You also don't need the parentheses -- these will capture the entire matched expression for use in backreferences, but as you don't have any it's then immediately thrown away. So just use: preg_replace("//s", "", $htmlPage); Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Chris, Ligaya, Dave, Thank you for responding. I understand the difference in principle between ereg and preg much better now. Chris wrote: ! in perl regular expressions means "not" so you need to escape it: \! Still, when including that escape character, the following preg expression does not find any matching text: preg_replace("/<\!DOCTYPE(.*)/", "", $htmlPage); Whereas this ereg expression does find a match: ereg_replace("", "", $htmlPage); What do I need to do to make the preg expression succeed just as the ereg expression does? Thank you for your time and advice. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
On 04/08/06, Chris <[EMAIL PROTECTED]> wrote: Dave M G wrote: > PHP List, > > Recently I wrote a piece of code to scrape data from an HTML page. > > Part of that code deleted all the unwanted text from the very top of the > page, where it says " of a "" tag. > Is there any reason why either ereg or preg would be more desirable over > the other? > Ereg uses POSIX regular expressions which only work on textual data and include locale functionalily. preg uses PCRE, which work on binary as well as textual data and is a more sophisticated regex engine, incorporating minimal matching, backreferences, inline options, lookahead/lookbehind assertions, conditional expressions and so on. They are often faster than the POSIX equivalents also. -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk
Re: [PHP] The difference between ereg and preg?
Dave M G wrote: PHP List, Recently I wrote a piece of code to scrape data from an HTML page. Part of that code deleted all the unwanted text from the very top of the page, where it says "of a "" tag. That code looks like this: ereg_replace("", "", $htmlPage); It works fine. But I noticed that on almost all the tutorial pages I looked at, they just about always used preg_replace, and not ereg_replace. It seemed that the main difference was that preg_replace required forward slashes around the regular expression, like so: preg_replace("//", "", $htmlPage); But that didn't work, and returned an error. Since ereg was working, though, I figured I would just stick with it. Still, I thought it worth asking: Is there any reason why either ereg or preg would be more desirable over the other? Why does the ereg work for the command above, but preg not? ! in perl regular expressions means "not" so you need to escape it: \! pcre expressions are very close to the same as in perl, so you can easily move the regular expression from one language to the other (whether that's good or not is another thing). If you have any perl experience, they are easier to understand. If you don't, they are a little harder to understand to start off with but are more powerful once you work them out. The ereg functions are simpler to use but miss a lot of functionality. Also according to this page: http://www.php.net/~derick/meeting-notes.html#move-ereg-to-pecl ereg will be moved to pecl which means it will be less available (ie most hosts won't install / enable it). -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The difference between ereg and preg?
Dave M G wrote: PHP List, Recently I wrote a piece of code to scrape data from an HTML page. Part of that code deleted all the unwanted text from the very top of the page, where it says "of a "" tag. That code looks like this: ereg_replace("", "", $htmlPage); It works fine. But I noticed that on almost all the tutorial pages I looked at, they just about always used preg_replace, and not ereg_replace. It seemed that the main difference was that preg_replace required forward slashes around the regular expression, like so: preg_replace("//", "", $htmlPage); But that didn't work, and returned an error. Since ereg was working, though, I figured I would just stick with it. Still, I thought it worth asking: Is there any reason why either ereg or preg would be more desirable over the other? Why does the ereg work for the command above, but preg not? Thank you for any advice. -- Dave M G From what I understand there are 2 schools of thought on regular expressions. There is the Perl (Perl Compatible Regular Expressions - preg) group and the POSIX (ereg) group. from the little I know they do the same thing but with different symbols for things. References: http://www.php.net/regex http://www.php.net/pcre -- life is a game... so have fun. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The difference between ereg and preg?
PHP List, Recently I wrote a piece of code to scrape data from an HTML page. Part of that code deleted all the unwanted text from the very top of the page, where it says "of a "" tag. That code looks like this: ereg_replace("", "", $htmlPage); It works fine. But I noticed that on almost all the tutorial pages I looked at, they just about always used preg_replace, and not ereg_replace. It seemed that the main difference was that preg_replace required forward slashes around the regular expression, like so: preg_replace("//", "", $htmlPage); But that didn't work, and returned an error. Since ereg was working, though, I figured I would just stick with it. Still, I thought it worth asking: Is there any reason why either ereg or preg would be more desirable over the other? Why does the ereg work for the command above, but preg not? Thank you for any advice. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php