Re: [PHP] regular expressions ?

2005-01-27 Thread Marek Kilimajer
Zouari Fourat wrote: to Marek Kilimajer : $i='5.'; if (($i=1) ($i=20) ($i==(int)$i)) echo 'yes'; // yes :'( ok, then use regexp: if (($i=1) ($i=20) regexp('^[0-9]+$', $i)) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] regular expressions ?

2005-01-27 Thread Robin Vickery
On Thu, 27 Jan 2005 16:56:05 +0100, Zouari Fourat [EMAIL PROTECTED] wrote: this is working fine : if (eregi(^-?([1-3])+$,$x) echo x is 1 or 2 or 3; i forgot to say that doesnt work with 1-20 :( how to do it ? You're far better off doing it arithmetically as someone already said,

Re: [PHP] regular expressions ?

2005-01-27 Thread Zouari Fourat
Robin : $i='2'; if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) { echo 'yes'; }else echo 'no'; stdout: no Marek : $i='02'; if (($i=1) ($i=20) (eregi('^[0-9]+$', $i))) echo 'yes'; stdout: yes i hate

Re: [PHP] regular expressions ?

2005-01-27 Thread John Nichel
Zouari Fourat wrote: Robin : $i='2'; if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) { Open the bracket for the last parameter... /^(20|1[0-9]|[1-9])$/ -^ -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] regular expressions ?

2005-01-27 Thread Leif Gregory
Hello Zouari, Thursday, January 27, 2005, 8:53:55 AM, you wrote: Z doesnt work ! Z this is working fine : Z if (eregi(^-?([1-3])+$,$x) Z echo x is 1 or 2 or 3; Whoops. Sorry.. That's what I get for throwing out an answer while on the run: Try this: ?php for ($x=0; $x 120; $x++) { if

Re: [PHP] regular expressions ?

2005-01-27 Thread Richard Lynch
Zouari Fourat wrote: Robin : $i='2'; if (preg_match('/^(20|1[0-9]|1-9])$/', $i)) { You are missing a [ before the 1-9 in after the last | The regex WILL work if you type it correctly :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List

Re: [PHP] regular expressions ?

2005-01-27 Thread Rick Fletcher
Robin Vickery wrote: On Thu, 27 Jan 2005 16:56:05 +0100, Zouari Fourat [EMAIL PROTECTED] wrote: this is working fine : if (eregi(^-?([1-3])+$,$x) echo x is 1 or 2 or 3; i forgot to say that doesnt work with 1-20 :( how to do it ? if (preg_match('/^(20|1[0-9]|1-9])$/', $candidate)) { //

Re: [PHP] regular expressions ?

2005-01-27 Thread Leif Gregory
Hello Rick, Thursday, January 27, 2005, 12:36:39 PM, you wrote: R /^(1?[1-9]|[12]0)$/ works too. The first part covers 1-9, 11-19; R the second part gets you 10 and 20. R Plus, it's ever so slightly shorter! And isnt' that what's most R important? :P Purty :grin: -- Leif (TB lists

[PHP] Regular expressions Q

2004-10-28 Thread Jack . van . Zanen
Hi All I'm trying to achieve the following: In a text string there may be a number of substrings that match my criteria. I need to retrieve all of them. This is what I have so far and works perfect for the first substring but ignores the possibility of others. I need to know if there are more

Re: [PHP] Regular expressions Q

2004-10-28 Thread Alex Hogan
ereg((([[:blank:]+]|^)[09][0-9][4789][0][0-9]{3}[abcABC]?),$zn[1],$zaakn ummers1); I thought that ereg would get all of them and store them in the array $zaaknummers1 however this is not the case I just asked a question similar to this the other day. Try using;

RE: [PHP] Regular expressions Q

2004-10-28 Thread Jack . van . Zanen
Thx, Just joined today, should have looked thru the archives first though. Jack -Original Message- From: Alex Hogan [mailto:[EMAIL PROTECTED] Sent: Thursday, October 28, 2004 3:31 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Regular expressions Q ereg

[PHP] Regular Expressions

2004-08-05 Thread Arik Raffael Funke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi together, I have a question about regular expressions. I want to get from following text... test: abc def ghi ...following... abc def ghi Can anybody tell me why preg_match(/test([.\n]*)/,...) does not work? And who is it done properly? Thanks

[PHP] Regular Expressions

2004-07-15 Thread Arik Raffael Funke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello together, I am havin trouble with php regular expressions. I would like to implement following pattern Last Name:\s*(.*)\n. - From following text, Name: James Last Name: Jason Street: abc I get just 'Jason'. But what I currently get is: Jason

Re: [PHP] Regular Expressions

2004-07-15 Thread Marek Kilimajer
Arik Raffael Funke wrote: Hello together, I am havin trouble with php regular expressions. I would like to implement following pattern Last Name:\s*(.*)\n. - From following text, Name: James Last Name: Jason Street: abc I get just 'Jason'. But what I currently get is: Jason Street: abc Obviously

Re: [PHP] Regular Expressions

2004-07-15 Thread Matt M.
Obviously the new-line is missed. Any thoughts on this? sample code: ereg(Last Name:\s*(.*)\n, $strInput, $regs) echo $regs[1]; try this: ereg(Last Name:\s*(.*[^\n]), $strInput, $regs); echo $regs[1]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Regular Expressions

2004-07-15 Thread Arik Raffael Funke
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thu, 15 Jul 2004 08:02:13 -0500 Matt M. [EMAIL PROTECTED] wrote: Obviously the new-line is missed. Any thoughts on this? sample code: ereg(Last Name:\s*(.*)\n, $strInput, $regs) echo $regs[1]; try this: ereg(Last

Re: [PHP] Regular Expressions

2004-07-15 Thread Jason Wong
On Thursday 15 July 2004 21:15, Arik Raffael Funke wrote: However if I have, Last Name: Street: Teststreet (no entry after last name) Both search strings return me: Street: Teststreet Also why doesn't Last Name:\s*(.*)$ work, and neither ^Last Name:\s*(.*). Both strings are

Re: [PHP] Regular Expressions Tester/designer

2004-06-20 Thread Tom Rogers
Hi, Sunday, June 20, 2004, 7:23:53 AM, you wrote: A Anyone know of a good regular expressions tester/designer for php coding A running windows. A I've looked at the Rad Software Regular Expressions Designer and it A looks pretty good except that it is intended for .net and it really A doesn't

Re: [PHP] Regular Expressions Tester/designer

2004-06-20 Thread Ulrik S. Kofod
Tom Rogers sagde: This works with perl regular expressions http://weitz.de/files/regex-coach.exe Thanks! Great tool! I really needed something like that. It just seems like it can't handle $1, $2 ...$x in the replacement string? Isn't there a way to make that work ? -- PHP General

Re[2]: [PHP] Regular Expressions Tester/designer

2004-06-20 Thread Tom Rogers
Hi, Sunday, June 20, 2004, 5:30:39 PM, you wrote: USK Tom Rogers sagde: This works with perl regular expressions http://weitz.de/files/regex-coach.exe USK Thanks! Great tool! I really needed something like that. USK It just seems like it can't handle $1, $2 ...$x in the replacement

[PHP] Regular Expressions Tester/designer

2004-06-19 Thread Al
Anyone know of a good regular expressions tester/designer for php coding running windows. I've looked at the Rad Software Regular Expressions Designer and it looks pretty good except that it is intended for .net and it really doesn't seem to be entirely PCRE compatible. Thanks -- PHP

Re: [PHP] Regular Expressions Tester/designer

2004-06-19 Thread Joel Kitching
On Sat, 19 Jun 2004 17:23:53 -0400, Al [EMAIL PROTECTED] wrote: Anyone know of a good regular expressions tester/designer for php coding running windows. I've looked at the Rad Software Regular Expressions Designer and it looks pretty good except that it is intended for .net and it really

[PHP] regular expressions php/perl/actionscript

2004-04-22 Thread Gabino Travassos
Hello I'm wondering if Regular Expressions are the same in Perl and PHP (and possibly Actionscript)? They look the same and smell the same, but if I see a book in a store for Perl Regular Expressions that's $10 cheaper than the PHP one (is there one?), then is it the same thing? While we're on

RE: [PHP] regular expressions php/perl/actionscript

2004-04-22 Thread Chris W. Parker
Gabino Travassos mailto:[EMAIL PROTECTED] on Thursday, April 22, 2004 12:24 PM said: I'm wondering if Regular Expressions are the same in Perl and PHP (and possibly Actionscript)? They look the same and smell the same, but if I see a book in a store for Perl Regular Expressions that's $10

Re: [PHP] regular expressions php/perl/actionscript

2004-04-22 Thread John W. Holmes
From: Gabino Travassos [EMAIL PROTECTED] I'm wondering if Regular Expressions are the same in Perl and PHP (and possibly Actionscript)? They look the same and smell the same, but if I see a book in a store for Perl Regular Expressions that's $10 cheaper than the PHP one (is there one?), then

Re: [PHP] regular expressions php/perl/actionscript

2004-04-22 Thread Gabino Travassos
I forgot to mention that in my XML file, inside the quotes in this attribute backColour=xx the x's will be variable..., so I need some kind of wildcard to select everything from backColour + the next 8 or 9 characters, cuz it might be backColour=333990 or whatnot. 'backColour' will be a

RE: [PHP] regular expressions php/perl/actionscript

2004-04-22 Thread Michal Migurski
I'm wondering if Regular Expressions are the same in Perl and PHP (and possibly Actionscript)? They look the same and smell the same, but if I see a book in a store for Perl Regular Expressions that's $10 cheaper than the PHP one (is there one?), then is it the same thing? this page will

Re: [PHP] regular expressions php/perl/actionscript

2004-04-22 Thread Gabino Travassos
Thanks for the suggestions. Between the online manual and the books I have I think I'll get there eventually. Sometimes my logic just sux. What I needed to do was have the user fill out a form and if they make changes to the XML file I would update the file. So, my long way around was to go

Re: [PHP] regular expressions php/perl/actionscript

2004-04-22 Thread Curt Zirzow
* Thus wrote Gabino Travassos ([EMAIL PROTECTED]): Hello I'm wondering if Regular Expressions are the same in Perl and PHP (and possibly Actionscript)? They look the same and smell the same, but if I see a book in a store for Perl Regular Expressions that's $10 cheaper than the PHP one (is

Re: [PHP] regular expressions php/perl/actionscript

2004-04-22 Thread David Scott
I believe Regular Expressions are language independent. Here is an O'Reilly book on the matter: http://www.oreilly.com/catalog/regex2/ Chris W. Parker wrote: Gabino Travassos mailto:[EMAIL PROTECTED] on Thursday, April 22, 2004 12:24 PM said: I'm wondering if Regular Expressions are the

[PHP] regular expressions

2004-04-09 Thread René Fournier
I'm trying to 'clean up' some text that is extracted from a web directory, and I need to use (I think) preg_replace or ereg_replace, etc. I've read a bunch of tutorials, but none of them seem to cover the particular thing I want to do. Here's an example of text I need to process: -

Re: [PHP] regular expressions

2004-04-09 Thread Richard Harb
Saturday, April 10, 2004, 2:02:04 AM, you wrote: I'm trying to 'clean up' some text that is extracted from a web directory, and I need to use (I think) preg_replace or ereg_replace, etc. I've read a bunch of tutorials, but none of them seem to cover the particular thing I want to do. Here's

[PHP] Regular Expressions with symmetrical contents

2004-04-08 Thread Michal Migurski
Hi, I'm trying to figure out an appropriate strategy for handling regexps where I need to parse input like the following: { {...} {...} (part I want to match) } more... ...The catch being that thepart I want to match can contain escaped curly braces, like so: \{ and \} It's not enough

Re: [PHP] Regular Expressions

2004-04-06 Thread Matt Palermo
What exactly does this do: / (?=p|br) [^]+ /x It may work, I just want to understand what it's looking for. Thanks, Matt Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Matt Palermo ([EMAIL PROTECTED]): I have a page where I am stripping the html tags

Re: [PHP] Regular Expressions

2004-04-06 Thread Curt Zirzow
* Thus wrote Matt Palermo ([EMAIL PROTECTED]): What exactly does this do: Your original expression: / (?!p|br) [^]* /x Find '' not followed by 'p|br' until the first '' we find. p class=foo - matches - matches Its a bit confusing as why the p * matches, perhaps

[PHP] Regular Expressions

2004-04-04 Thread Matt Palermo
I have a page where I am stripping the html tags down. Basically, it will allow certain tags, but still strips out ALL attributs of the tag, so it works something like this: $allowed_tags = pbrstrongbiu; // State which tags are allowed $info = strip_tags($info, $allowed_tags); // Strip all

Re: [PHP] Regular Expressions

2004-04-04 Thread Curt Zirzow
* Thus wrote Matt Palermo ([EMAIL PROTECTED]): I have a page where I am stripping the html tags down. Basically, it will allow certain tags, but still strips out ALL attributs of the tag, so it works something like this: $allowed_tags = pbrstrongbiu; // State which tags are allowed $info

[PHP] regular expressions

2004-02-17 Thread pete M
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

Re: [PHP] regular expressions

2004-02-17 Thread Matt Matijevich
snip Anyone recommend a book for a regex newbie ? /snip O'Reilly usually has some good stuff http://www.oreilly.com/catalog/regex/ There is plenty of tutorials online too, just google and you will get a bunch of results. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] Regular expressions

2004-02-03 Thread pete
Hi there, I have serious probems resolving regular expressions. I wish to replace a substring with a given pattern with results of a function with a backreference used as argument. SAMPLE: function check_this_out($somevalue) { $url_array = ''; $i=0; $query = SELECT SomeRow FROM SomeTable

Re: [PHP] Regular expressions

2004-02-03 Thread Jochem Maas
Pete, you can probably do what you want with preg_replace_callback: http://nl2.php.net/manual/en/function.preg-replace-callback.php only the function call will be set up slightly differently; namely you don't pass the callback reference directly, instead the callback function that is called

Re: [PHP] Regular expressions

2004-02-03 Thread John W. Holmes
From: Jochem Maas [EMAIL PROTECTED] alternatively (actually this looks like the easier way to do it!) use preg_replace(), with the 'e' modifier tagged onto the end of the replacement expression: the 'e' modifier causes the expression to be evaluated as PHP.

Re: [PHP] Regular expressions

2004-02-03 Thread pete
Thank you very much Jochem and John. It works like a charm now, and I was beginning to grow weary after experimenting with result sets for almost 10 hours now. How would you - by the way - concatenate text to the replacement string? ;-Pete On Tue, 3 Feb 2004 14:15:00 -0500, [EMAIL PROTECTED]

Re: [PHP] Regular expressions

2004-02-03 Thread Jochem Maas
replacement is evaluated... therefore: function check_this_out($arg) { return a href='#'$arg/a; } $myString = 'hello'; $pattern = '/(.*)/e'; $replacement = check_this_out('\\1' . ' $myString'); echo preg_replace($pattern, $replacement, 'test says:'); [EMAIL PROTECTED] wrote: Thank you very

[PHP] Regular expressions

2003-11-27 Thread Sheni R. Meledath
Hi, Could anybody help me to create a regular expression to remove a pattern from a string. $querystring = http://10.100.1.7/cdms/prfl.phtml?action=searchcusttype=1gender=x=22y=10page=2 I would like to remove page=2 from this query string. The page number changes. That is the reason why I

Re: [PHP] Regular expressions

2003-11-27 Thread Eugene Lee
On Thu, Nov 27, 2003 at 01:20:57PM +0400, Sheni R. Meledath wrote: : : Could anybody help me to create a regular expression to remove a pattern : from a string. : : $querystring = http://10.100.1.7/cdms/prfl.phtml?action=searchcusttype=1gender=x=22y=10page=2 : : I would like to remove page=2

Re: [PHP] Regular expressions

2003-11-27 Thread Kelly Hallman
On Thu, 27 Nov 2003, Eugene Lee wrote: Instead of using regexps on the URL, it might be easier (and safer) to loop through $_GET, build a new $geturl array, add/delete/change any variables in $geturl, then build a new $geturlstr string that can then be appended to your hyperlinks. What about

[PHP] Regular expressions

2003-10-24 Thread Fernando Melo
Hi all, 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

Re: [PHP] Regular expressions

2003-10-24 Thread Curt Zirzow
* Thus wrote Fernando Melo ([EMAIL PROTECTED]): Hi all, 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

[PHP] Regular Expressions

2003-10-16 Thread Shmuel
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:

[PHP] Regular expressions

2003-10-16 Thread Shmuel
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:

Re: [PHP] Regular Expressions

2003-10-16 Thread Jacob Vennervald
preg_replace(/aIone/, alone, I am not aIone); But you don't need regular expressions for this. Jacob On Thu, 2003-10-16 at 14:35, Shmuel wrote: 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

Re: [PHP] Regular Expressions

2003-10-16 Thread Justin French
On Thursday, October 16, 2003, at 10:35 PM, Shmuel wrote: 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 ? You want to change an uppercase i/I into a lowercase l/L??

Re: [PHP] Regular Expressions

2003-10-16 Thread Eugene Lee
On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote: : : 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. This doesn't make sense. It sounds like you want to replace every occurance of 'I' inside a

Re: [PHP] Regular Expressions

2003-10-16 Thread Shmuel
Eugene Lee wrote: On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote: : : 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. This doesn't make sense. It sounds like you want to replace every occurance

Re: [PHP] Regular Expressions

2003-10-16 Thread Eugene Lee
On Thu, Oct 16, 2003 at 09:41:39PM +0300, Shmuel wrote: : Eugene Lee wrote: : On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote: : : : : 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. : : This

Re: [PHP] Regular Expressions

2003-10-16 Thread Curt Zirzow
* Thus wrote Shmuel ([EMAIL PROTECTED]): Eugene Lee wrote: On Thu, Oct 16, 2003 at 03:35:57PM +0300, Shmuel wrote: : : 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. This doesn't make sense. It

[PHP] regular expressions question

2002-10-30 Thread Simon Dedeyne
I have a little question. I'm having some difficulty with regular expressions: here it is: (this)example should be output in an array [0]= this [1]= thisexample I'm supposing this should be done with preg_grep, but I'm not really familiar with some of it's syntax for the regular expression. I

Re: [PHP] regular expressions question

2002-10-30 Thread Rasmus Lerdorf
$str = (this)example; preg_match(/\((.*?)\)(.*)/,$str,$regs); $a[0] = $regs[1]; $a[1] = $regs[1].$regs[2]; On Wed, 30 Oct 2002, Simon Dedeyne wrote: I have a little question. I'm having some difficulty with regular expressions: here it is: (this)example

Re: [PHP] regular expressions question

2002-10-30 Thread jla21
If I understand you correctly, I think you want this? $matches = array(); $test = (this)example; preg_match(/\((.*)\)(.*)/, $test, $matches); array_shift($matches); On Wed, 30 Oct 2002, Simon Dedeyne wrote: I have a little question. I'm having some difficulty with regular expressions:

Re: [PHP] regular expressions question

2002-10-30 Thread jla21
Whoops.. I missed one bit. Rasmus did it right. ;) On Wed, 30 Oct 2002 [EMAIL PROTECTED] wrote: If I understand you correctly, I think you want this? $matches = array(); $test = (this)example; preg_match(/\((.*)\)(.*)/, $test, $matches); array_shift($matches); On Wed, 30 Oct 2002,

[PHP] Regular Expressions (PCRE library)

2002-08-03 Thread Jürgen
Hello! It´s driving me nuts, am in the middle of reading Mastering Regular Expressions (O'Reilly), and because i like to learn whilst doing, well, you can picture the rest. Anybody please tell me why the following is not working $test = Hello, end why is not workin, END.; //before echo $test

Re: [PHP] Regular Expressions (PCRE library)

2002-08-03 Thread Jason Wong
On Sunday 04 August 2002 01:44, Jürgen wrote: Anybody please tell me why the following is not working $test = Hello, end why is not workin, END.; //before echo $test . br; //Finds beginning of a line, followed by e or E, and replaces it with A. At least it should do it, but it doesn't

Re: [PHP] Regular Expressions (PCRE library)

2002-08-03 Thread Jürgen
Well, i know it should work, but it does not work. Even if i Change the first letter into e or E it does not work. This is so frustrating, this is prolly the most easiest regular expression i could start with and yet i fail and nobody seems to know why it aint working neither This should

Re: [PHP] Regular Expressions (PCRE library)

2002-08-03 Thread Jason Wong
On Sunday 04 August 2002 03:47, Jürgen wrote: Well, i know it should work, but it does not work. Even if i Change the first letter into e or E it does not work. This is so frustrating, this is prolly the most easiest regular expression i could start with and yet i fail and nobody seems to

Re: [PHP] Regular Expressions (PCRE library)

2002-08-03 Thread Jürgen
No im not saying that, im merely saying that in my given example even if i turn the Hello into Ello it does not replace it, besides : ^ = assert start of subject (or line, in multiline mode) * I

[PHP] Regular expressions test code

2002-08-02 Thread Børge Strand
I'm starting work on regular expressions in PHP these days. Just thought I'd share my test code for others out there who are fresh starters with the language and regular expressions. file parser.php: ?php // copyright Børge Strand // use this code as you feel like! print html\n;

[PHP] Regular Expressions Help

2002-06-05 Thread J. Younker
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:]\.-_?/=]); $replace = http://\\2\\3;; $URL =

Re: [PHP] Regular Expressions Help

2002-06-05 Thread Jim lucas
PROTECTED] Sent: Wednesday, June 05, 2002 8:22 AM Subject: [PHP] Regular Expressions Help 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

Re: [PHP] Regular Expressions Help

2002-06-05 Thread J. Younker
- Original Message - From: J. Younker [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, June 05, 2002 8:22 AM Subject: [PHP] Regular Expressions Help Hi, I'm trying to use eregi_replace to check a user-submitted URL, but I keep getting the following error message: Warning: Invalid

[PHP] Regular Expressions...

2002-05-31 Thread Brian McGarvie
All, I have a text field that a user can enter text into, I then explode it into an array, and ultimatley build a regular expression such as: /(advance|racingx)|(advance|racingx)/i for use in: preg_match ($reg_expr, $file); however the expression above doesnot yeild the required result, it

Re: [PHP] Regular Expressions...

2002-05-31 Thread Michael Sims
On Fri, 31 May 2002 12:32:29 +0100, you wrote: example of the contents of $file that might pass is: advance_racingx_14_4_29.pdf another might be, which would not pass is: advance_fork10_3_4_11.pdf If you need it to be in that specific order, use the following:

[PHP] regular expressions help please

2002-04-30 Thread Ed Lazor
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. For example, pulling everything except the word run from the water run was

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 15:51, 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? Is this for a programming assignment/exercise? Do you /have/ to use regex? Other

[PHP] regular expressions help please

2002-04-30 Thread John Fishworld
I'm trying to find files in my array for example =lg_imode.gif and =/db/imodeklein/edgar-IMODE-1-.gif I want to differentiate between the files with slash at the front and ones without so that I can add a server path ! but as usual I' m having problems with the correct regex At the moment I've

RE: [PHP] regular expressions help please

2002-04-30 Thread Ford, Mike [LSS]
-Original Message- From: John Fishworld [mailto:[EMAIL PROTECTED]] Sent: 30 April 2002 09:32 I'm trying to find files in my array for example =lg_imode.gif and =/db/imodeklein/edgar-IMODE-1-.gif I want to differentiate between the files with slash at the front and ones

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 16:31, John Fishworld wrote: I'm trying to find files in my array for example =lg_imode.gif and =/db/imodeklein/edgar-IMODE-1-.gif Perhaps you should clarify your problem. First of all does your array contain just gif files (ie *.gif) or does it contain all sorts

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
Okay right I'm experimenting with an i-mode parser ! I copy the file (url entered) to a local location ! Then read through the whole file line at a time and change/replace the things that need replaceing ! On of the things that I need to replace is the links to the pictures so that they still

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 19:17, John Fishworld wrote: Okay right I'm experimenting with an i-mode parser ! I copy the file (url entered) to a local location ! Then read through the whole file line at a time and change/replace the things that need replaceing ! On of the things that I need to

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
$imode_code = file($url_file); $file_name = basename($url_file); $path = dirname($url_file); $stripped_path = eregi_replace(^(.{2,6}://)?[^/]*/, , $path); $next_path = eregi_replace($stripped_path, , $path); $next_path_1 = eregi_replace(/$ , , $next_path); // create and open a file to write to

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 19:43, John Fishworld wrote: $imode_code = file($url_file); $file_name = basename($url_file); $path = dirname($url_file); $stripped_path = eregi_replace(^(.{2,6}://)?[^/]*/, , $path); On Tuesday 30 April 2002 19:17, John Fishworld wrote: Okay right I'm

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
Duh ! lol sorry ! Example 1 html head meta http-equiv=content-type content=text/html;charset=iso-8859-1 meta name=generator content=Edit Plus titleLocations/title /head body bgcolor=#6699FF div align=center pfont color=blackWelcome tobr /fontfont color=redimg src=lg_imode.gif alt=

Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz
On Tue, 30 Apr 2002, Ed Lazor wrote: Pull everything except a specific word from a sentence. For example, pulling everything except the word run from the water run was steep. $str = 'the water run was steep'; print preg_replace('/(\s*water)/', '', $str); Pull all words from a string

Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong
On Tuesday 30 April 2002 21:09, John Fishworld wrote: Duh ! lol sorry ! img src=/db/imodeklein/edgar-IMODE-1-.gif vspace=2br#59091;nbsp;a href=imode.fpl?op=imodecardprefix=IMODEnummer=1suffx=uid=55%2eFAGAEpa Unfortunately, no. Could you post say 20 lines of this file you're talking

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
Thanks after playing about with that I've got the following which does seem to work ! $imode_code[$i] = eregi_replace((src=)(\)([a-z0-9_\/-]+\.gif)(\), \\1\\2$path/\\3\\2, $imode_code[$i]); Very very very slowly getting the hang of regexs ! What does your /i do at the end ??? Thanks Try

Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz
On Wed, 1 May 2002, John Fishworld wrote: Thanks after playing about with that I've got the following which does seem to work ! $imode_code[$i] = eregi_replace((src=)(\)([a-z0-9_\/-]+\.gif)(\), \\1\\2$path/\\3\\2, $imode_code[$i]); Very very very slowly getting the hang of regexs !

Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld
aha ! thats very strange then because mine works at the moment but if I add the /i at the end then it doesn't ! On Wed, 1 May 2002, John Fishworld wrote: Thanks after playing about with that I've got the following which does seem to work ! $imode_code[$i] =

Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz
I wasn't paying that much attention. The /i is a preg thing. It's the same as changing from ereg to eregi. miguel On Wed, 1 May 2002, John Fishworld wrote: aha ! thats very strange then because mine works at the moment but if I add the /i at the end then it doesn't ! On Wed, 1 May 2002,

Re: [PHP] Regular Expressions

2002-04-24 Thread Evan Nemerson
, April 23, 2002 4:38 PM To: Devin Atencio; [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expressions Uhhh... something like ereg([_a-zA-Z\-]+\@[\.a-zA-Z\-]+\.com,$variable); SHOULD work... If you want to make sure they're @domain.com instead of any domain, try... ereg([_a-zA-Z\-]+\@[\.a-zA-Z

Re: [PHP] Regular Expressions

2002-04-24 Thread Miguel Cruz
On Wed, 24 Apr 2002, Evan Nemerson wrote: ereg(([_a-zA-Z\-]+|\*)\@[\.a-zA-Z\-]+\.com,$variable); should work, but test it. I'm not 100% the wildcard part will work. An internet domain name cannot contain an underscore ( _ ). ...and a whole lot of them don't end in .com! miguel -- PHP

Re: [PHP] Regular Expressions

2002-04-24 Thread Evan Nemerson
A domain cannot contain an underscore, but unless i'm mistaken the USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+ You're right about the .com. senior moment. here's a better version ereg(([_a-zA-Z\-]+|\*)\@[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+,$variable); won't make sure there are letters

Re: [PHP] Regular Expressions

2002-04-24 Thread Miguel Cruz
On Wed, 24 Apr 2002, Evan Nemerson wrote: A domain cannot contain an underscore, but unless i'm mistaken the USERNAME can. the domain name REGEX is [\.a-zA-Z\-]+ ereg(([_a-zA-Z\-]+|\*)\@[\.a-zA-Z\-]+\.[\.a-zA-Z\-]+,$variable); Right you are. I spaced out right past the . But on the other

RE: [PHP] Regular Expressions

2002-04-24 Thread John Holmes
: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 5:17 PM To: Evan Nemerson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expressions On Wed, 24 Apr 2002, Evan Nemerson wrote: A domain cannot contain an underscore, but unless i'm mistaken the USERNAME can

Re: [PHP] Regular Expressions

2002-04-24 Thread Evan Nemerson
don't know if it does any checking or validating or what...but maybe it'll help?? ---John Holmes... -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 5:17 PM To: Evan Nemerson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Regular

Re: [PHP] Regular Expressions

2002-04-24 Thread Evan Nemerson
Okay... ereg(([_a-zA-Z\-\=\+0-9]+|\*)\@[\.a-zA-Z\-0-9]+\.[\.a-zA-Z\-0-9]+,$variable); Anything else? That one works, right??? So far we've got a-z, A-Z, underscores, hyphens, equals, and pluses. Oh crap numbers! Okay added it in up there. Anything else? On Wednesday 24 April 2002 17:17

[PHP] Regular Expressions

2002-04-23 Thread Devin Atencio
I need to check a variable to see if the format fits one of the following: [EMAIL PROTECTED] or *@domain.com or *@*.domain.com How can I do this with regex? Any help would be greatly appreciated. Devin Atencio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Regular Expressions

2002-04-23 Thread Evan Nemerson
Uhhh... something like ereg([_a-zA-Z\-]+\@[\.a-zA-Z\-]+\.com,$variable); SHOULD work... If you want to make sure they're @domain.com instead of any domain, try... ereg([_a-zA-Z\-]+\@[\.a-zA-Z\-]+domain\.com,$variable); if you want to validate e-mail address formats, there is (if memory

[PHP] regular expressions: HUGE speed differences

2002-04-06 Thread Ando
Im using a regular expression, to get all urls from a file. When using it on the webserver, it processes a 25kb html file about 0.25 seconds (PIII 350, 128mb ram, linux 2.2.13-7mdk, php 3.0.12). When i try the same on my machine (Celeron 300A, 192mb ram.), it does it about 14-17 seconds, which

Re: [PHP] regular expressions: HUGE speed differences

2002-04-06 Thread heinisch
PIII 400MHz, 512Mb, SuSe 6.4, 2.2.14 smp, php 3.0.16, Completed in 0.76187908649445 seconds PIII 350MHz, 256Mb, Suse 7.3, 2.4.9, php 4.0.6, Completed in 2.6342689990997 seconds File Size:28537kb, But for real tests, send the original file you use direct BTW How the hell did you develop this

[PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy
I am trying to do a match for an expression and it to a variable from the output of a command: ?php $lines = file ($file); while (list ($line_num, $line) = each ($lines)) { $trimline = trim ($line); $output = shell_exec ($prog $cmdline $trimline ); } ? How can look through $output to

<    1   2   3   >