RE: [PHP] Regular Expression

2003-07-08 Thread Giz
I read your regex as -match start of line -followed by p, followed by o =followed by single space -followed by b,o,x -followed by end of line If someone puts in PO BOX 343, then your regex will not match. If someone puts in PO BOX 12, then your regex will not match. If you're saying that you

Re: [PHP] Regular Expression

2003-07-08 Thread Wendell Brown
On Mon, 07 Jul 2003 21:59:23 -0700, Ralph Guzman wrote: I have a form where I have to check whether user is submitting a PO Box as an address. I wrote the following using eregi, but it returns true even when the field is not Po Box. How do I go about doing this properly? if(eregi(^Po Box$,

RE: [PHP] Regular Expression

2003-07-08 Thread Ralph Guzman
Thanks Wendell. This is exactly what I was looking for. -Original Message- From: Wendell Brown [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 4:47 AM To: PHP General Mailing List Subject: Re: [PHP] Regular Expression On Mon, 07 Jul 2003 21:59:23 -0700, Ralph Guzman wrote: I

Re: [PHP] Regular Expression

2003-07-08 Thread Paul Chvostek
On Tue, Jul 08, 2003 at 06:47:26AM -0500, Wendell Brown wrote: I think this would do better... if( preg_match( /P[\. ]*O\.* +BOX/i, $address ) ) Unless preg_match does something non-standard, you don't need to escape a period that's inside square brackets. In fact, the regexp you've

RE: [PHP] Regular Expression

2003-07-01 Thread Jay Blanchard
[snip] I am currently using this piece of code to validate wether or not an address has only letters, numbers, #, or - in it: if (!ereg(^[A-Za-z0-9 #-]{1,20}, $_POST[address1])) { $error = 1; $msg .= Address must only contain letters, numbers, #,

RE: [PHP] Regular Expression

2003-07-01 Thread Dan Joseph
Hi, It's not so much that your regex is wrong, but there are other functions that you may want to use, such as is_numeric(), is_integer(), is_string() (there is a good example of checking for an alphabetic string on the php site) That would have been my first choice also, however,

Re: [PHP] Regular Expression

2003-07-01 Thread Jason Wong
On Tuesday 01 July 2003 21:38, Dan Joseph wrote: Hi Everyone, I am currently using this piece of code to validate wether or not an address has only letters, numbers, #, or - in it: if (!ereg(^[A-Za-z0-9 #-]{1,20}, $_POST[address1])) { $error = 1;

RE: [PHP] Regular Expression

2003-07-01 Thread Dan Joseph
Hi, You're only checking for valid characters at the *start* of the string, you need to check to the *end* of the string as well: ^[A-Za-z0-9 #-]{1,20}$ ought to do it. It sure did do it. Thank you! I didn't realize that the $ did that. Thanks for the info. -Dan Joseph --

RE: [PHP] Regular Expression

2003-07-01 Thread Jay Blanchard
[snip] That would have been my first choice also, however, with the # and - being legal, things like ctype_alnum and others don't work out. [/snip] Here is an example of something that I did before; $alphachar = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ; $ld1alpha =

RE: [PHP] Regular Expression

2003-07-01 Thread Dan Joseph
Hi, That might actually be a good solution for another item I'm working with. Thanks for the tip. -Dan Joseph -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 10:10 AM To: Dan Joseph; [EMAIL PROTECTED] Subject: RE: [PHP] Regular

Re: [PHP] Regular Expression Help in my PHP! Sorry if wrong group

2003-01-15 Thread 1LT John W. Holmes
I have a script that turns certain words into links. That I am having no problems with, it is when I want to turn the links back in to plain text that I am having the problem. Below are my examples. And I know my regex is being greedy but I don't know how to stop it from being so damn

Re: [PHP] Regular Expression Help in my PHP! Sorry if wrong group

2003-01-15 Thread Jason Lehman
Thanks for the response. I found this web page (http://www.itworld.com/nl/perl/01112001/) right after I submitted my question. It was great for explaining regexp's greediness. 1lt John W. Holmes wrote: I have a script that turns certain words into links. That I am having no problems with, it

Re: [PHP] regular expression

2003-01-14 Thread Chris Hayes
At 10:49 14-1-03, you wrote: hi, i wrote a regular expression to match email adresses: $text = preg_replace(/([a-z0-9_]|\\-|\\.)+@([^[:space:]]*)([[:alnum:]-])/i, a href=\mailto:\\1\;\\1/a, $text); unluckily also things like ftp:[EMAIL PROTECTED] were matched. so i rewrote it to: $text =

Re: [PHP] regular expression help

2003-01-07 Thread Maxim Maletsky
Here is your answer: http://www.phpbuilder.com/columns/ying2718.php3?page=2 -- Maxim Maletsky [EMAIL PROTECTED] adrian [EMAIL PROTECTED] [EMAIL PROTECTED] wrote... : I'm a bit useless at regular expressions so i thought i ask. i need to turn all [link url=http://www.site.com] link to

Re: [PHP] regular expression help

2003-01-07 Thread Khalid El-Kary
why don't you just use str_replace ? I'm a bit useless at regular expressions so i thought i ask. i need to turn all [link url=http://www.site.com] link to site [/link] in a string into html a href= ...etc and back again. thanks adrian -- PHP General Mailing List

Re: [PHP] Regular Expression trouble

2002-11-14 Thread Ewout de Boer
You could exclude the '}' sign from the expression $content = ereg_replace(\{[^}]*},,$content); This should do the trick... i'm not 100% certain about the '[^}]' expression, but you should find it in any regexp tutorial regards, Ewout de Boer - Original Message - From: Brent Baisley

Re: [PHP] Regular Expression

2002-11-07 Thread Ernest E Vogelsinger
At 07:33 07.11.2002, Salman said: [snip] ereg(([-d])[rwxst-]{9}.* [0-9]* [a-zA-Z]+ [0-9: ]* (.+),$dirline,$regs); This regular expressions parses the following line: drwxrwxrwx 1 ownergroup 0 Nov 5 23:19 fantasy to return: fantasy (or

Re: [PHP] Regular Expression

2002-11-07 Thread Steve Edberg
As someone else mentioned, filenames with embedded spaces can be confusing and should be avoided where possible (in the future, I'd replace the space with an underscore _). However, the following will do what you want (untested): $regs = preg_split('/\w+/', $dirline, 9); $regs[8] will

Re: [PHP] regular expression and exact word search...

2002-11-07 Thread Maxim Maletsky
Try looking for search engine scripts - they have this feature very simple. -- Maxim Maletsky [EMAIL PROTECTED] BAROILLER Pierre-Emmanuel [EMAIL PROTECTED] wrote... : Hi! does someone know how to find an exact word in a content with html tags ? I'm using a regexp like this :

Re: [PHP] regular expression and exact word search...

2002-11-07 Thread .: B i g D o g :.
Which functions are you using to do the regex stuff... That might help...also check out... On Thu, 2002-11-07 at 15:42, BAROILLER Pierre-Emmanuel wrote: Hi! does someone know how to find an exact word in a content with html tags ? I'm using a regexp like this : $searchRegEx =

Re: [PHP] regular expression and exact word search...

2002-11-07 Thread BAROILLER Pierre-Emmanuel
I work with preg_match_all to get all matching words and preg_replace_callback to replace found sentences... before runing the php pass, I take results from a mysql table with a query like this : select * from mytable where content REGEXP '[[::]]theword[[::]] But... I can't get all

Re: [PHP] regular expression and exact word search...

2002-11-07 Thread .: B i g D o g :.
This should help u out... http://www.php.net/manual/en/pcre.pattern.modifiers.php On Thu, 2002-11-07 at 18:29, BAROILLER Pierre-Emmanuel wrote: I work with preg_match_all to get all matching words and preg_replace_callback to replace found sentences... before runing the php

Re: [PHP] regular expression and exact word search...

2002-11-07 Thread rija
How about this one, $word_search = 'blablabla' ; echo eregi_replace(($word_search),b\\1/b,$html) ; // - Original Message - From: BAROILLER Pierre-Emmanuel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, November 08, 2002 2:42 AM Subject: [PHP] regular expression and exact word

Re: [PHP] regular expression question

2002-11-01 Thread John Nichel
It might, you should test it to find out. John Meyer wrote: I've got a regexp: (EV[0-9]{2})!([0-9]{4}-[0-9]{2}-[0-9]{2})!(GR[0-9]{2}).txt My question is, will it match this: EV01!2002-11-09!VR01!GR01.txt And anything formatted like this: (EV02, and so forth). -- PHP General Mailing

Re: [PHP] Regular Expression (for ereg(i))

2002-10-14 Thread Steel
Hi Ns_Andy, Monday, October 14, 2002, 1:27:06 PM, I've got: N if I want eregi to return false if the string contains char, N for example, N AB //false will be returned. N what's the reg expression I can use? eregi will return false if there is no such expression; For Your example it will be:

RE: [PHP] Regular Expression (for ereg(i))

2002-10-14 Thread John W. Holmes
if(ereg(,$string)) { echo bad string; } else { echo good string; } If you're trying to do some HTML filtering, there are better ways to do it. ---John Holmes... -Original Message- From: Ns_Andy [mailto:[EMAIL PROTECTED]] Sent: Monday, October 14, 2002 5:27 AM To: [EMAIL PROTECTED]

RE: [PHP] Regular expression help converting doc to xml

2002-10-02 Thread Geoff
(For the archives) The RegEx I finally used was this: search: D(.*) replace: DD\1/DD I tried this in 3 editors: jEdit, eMacs and BBEdit jEdit interpreted the replace expression as literally \1 eMacs didn't like the parenthesis in the search string In BBEdit it worked like a charm. Not sure

RE: [PHP] Regular Expression

2002-10-01 Thread Ford, Mike [LSS]
-Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: 01 October 2002 02:21 To: 'Daren Cotter'; 'PHP General Mailing List' City: Just ' ?? I'd allow space and period, too, for Ft. Gordon for example. ^[-a-zA-Z0-9' .]+$ Well, there's an English west

RE: [PHP] Regular expression help converting doc to xml (somewhatOT)

2002-09-30 Thread Geoff
On Fri, 2002-09-27 at 16:53, John Holmes wrote: This isn't accurate enough because DT is not always preceeded by: DD some text. It is sometimes preceeded by DT some text /DT or other items. This expression matches fairly well: DD[a-zA-Z0-9\.,'\-\s]* So it matches up to the DT: DD A whole bunch

RE: [PHP] Regular Expression

2002-09-30 Thread John W. Holmes
I need a regular expression to verify various inputs on my form. I know the base case of: ^[a-zA-Z0-9]+$ matches any letter or number. I'm looking for various input from the list as to what characters should be allowed in the following fields: Name: I would think -, ', and space for

RE: [PHP] Regular Expression

2002-09-30 Thread Daren Cotter
John, What about foreign names...such as the umlaut in German? I'm not interested in allowing ALL of the characters, just the most common ones...I'd hate to restrict a genuine registration because the name contains an unaccepted character. Know what I mean? --- John W. Holmes [EMAIL PROTECTED]

RE: [PHP] Regular Expression

2002-09-30 Thread John W. Holmes
What about foreign names...such as the umlaut in German? I'm not interested in allowing ALL of the characters, just the most common ones...I'd hate to restrict a genuine registration because the name contains an unaccepted character. Know what I mean? Well, that wasn't in your original

RE: [PHP] Regular expression help converting doc to xml

2002-09-27 Thread John Holmes
I have a fairly large html document that I need to convert to xml. The current format is is: DD A whole bunch of text DT Something else /DT (There is a new line in there before DT) Which I need to convert to DD A whole bunch of text /DD DT Something else /DT $new_text =

Re: [PHP] Regular expression for correcting proper nouns

2002-07-17 Thread Jason Wong
On Wednesday 17 July 2002 20:07, Henry wrote: Hi All, I'm looking for a simple was to correct a list of proper nouns given all in lower case! For example given $string=london paris rome; I would like London Paris Rome. However there is one cavet; if the word already has a captital

Re: [PHP] Regular expression

2002-07-17 Thread Andrey Hristov
Something like this. $your_string = preg_replace('/[\d\w]+@([\w\d]{3,}\.)+([\w]{2,4})/','', $your_string); HTH Best regards, Andrey Hristov - Original Message - From: Michal Albrecht [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 17, 2002 1:08 PM Subject: [PHP] Regular

Re: [PHP] Regular expression

2002-07-17 Thread Michal Albrecht
Andrey Hristov wrote: Something like this. $your_string = preg_replace('/[\d\w]+@([\w\d]{3,}\.)+([\w]{2,4})/','', $your_string); HTH Best regards, Andrey Hristov Thank you very much for your time, but this strips the e-mail address and lives the domain. Could you give me some hints on

Re: [PHP] Regular expression

2002-07-17 Thread Analysis Solutions
On Wed, Jul 17, 2002 at 04:03:02PM +0200, Michal Albrecht wrote: Andrey Hristov wrote: $your_string = preg_replace('/[\d\w]+([\w\d]{3,}\.)+([\w]{2,4})/','', Thank you very much for your time, but this strips the e-mail address and lives the domain. Could you give me some hints on how to

Re: [PHP] Regular Expression Problem

2002-07-02 Thread Jason Wong
On Wednesday 03 July 2002 01:40, Martin Clifford wrote: Hey all! I'm trying to get this darn eregi_replace() to work, but it doesn't produce any results at all. I want it to find all occurances of PHP variables. Here is the regexp $output = eregi_replace(^[\$]{1,2}[a-zA-Z][0-9]+$,

Re: [PHP] Regular Expression Problem

2002-07-02 Thread Martin Clifford
Even this: $output = preg_replace(/^[\$]{1,2}[a-zA-Z][0-9]+$/, b\\1/b, $var); echo $output; Doesn't work. It just takes whatever you put into $var, then puts it into $output, and outputs it to the screen. I want to change anything resembling a PHP variable, i.e. $var, $$var or $var to

Re: [PHP] Regular Expression Problem

2002-07-02 Thread Erik Price
On Tuesday, July 2, 2002, at 01:40 PM, Martin Clifford wrote: I'm trying to get this darn eregi_replace() to work, but it doesn't produce any results at all. I want it to find all occurances of PHP variables. Here is the regexp $output = eregi_replace(^[\$]{1,2}[a-zA-Z][0-9]+$, b\\1/b,

Re: [PHP] Regular Expression Problem

2002-07-02 Thread Jason Wong
On Wednesday 03 July 2002 01:59, Martin Clifford wrote: Even this: $output = preg_replace(/^[\$]{1,2}[a-zA-Z][0-9]+$/, b\\1/b, $var); echo $output; Doesn't work. It just takes whatever you put into $var, then puts it into $output, and outputs it to the screen. I want to change anything

Re: [PHP] Regular Expression Problem

2002-07-02 Thread Uli B
- don't use /^ .. $/ if you want to replace all occurences. ^ and $ refer to the very start and end of the whole string and make no sense at all - at least in this case. your regexp will not match at all unless $var contains only a single variable and nothing more - either capture

Re: [PHP] Regular expression newbie question, convert this: [::word1\ word2 \ word3::] to : .word1 word2 word3.

2002-06-16 Thread Lance
hi dan, its because the html text is from user input. and i dont wanna spend too much time educating them on coding with php. sometime its a pain trying to get them to understand the codes. so i just wanna give them some simple commands in php whereby they can happily insert date formats on a

Re: [PHP] Regular expression newbie question, convert this: [::word1 \ word2 \ word3::] to : .word1 word2 word3.

2002-06-16 Thread Analysis Solutions
Lance: On Sun, Jun 16, 2002 at 03:19:39PM +0800, Lance wrote: its because the html text is from user input. So, you're going to run eval() on user supplied input? Now THAT's scarry. I strongly urge you to rethink what you're doing. --Dan -- PHP classes that make web

Re: [PHP] Regular expression newbie question, convert this: [::word1\ word2 \ word3::] to : .word1 word2 word3.

2002-06-15 Thread Lance
hi, thanks for the code. i tried. it only worked if the string is simply the one i wanna convert. but that particular string is in the middle of a long text, and there are multiple occurance, it won't. however, i did manage to come up with this code that worked. but i believe it can be

Re: [PHP] Regular expression newbie question, convert this: [::word1 \ word2 \ word3::] to : .word1 word2 word3.

2002-06-15 Thread Analysis Solutions
Hi Lance: On Sat, Jun 15, 2002 at 06:54:24PM +0800, Lance wrote: hi, thanks for the code. i tried. it only worked if the string is simply the one i wanna convert. but that particular string is in the middle of a long text, and there are multiple occurance, it won't. Strange. It should

Re: [PHP] Regular expression newbie question, convert this: [::word1\ word2 \ word3::] to : .word1 word2 word3.

2002-06-15 Thread Lance
hi, i was developing an application that will read in the content of a html file. and within this html file contains php variables which will be replaced using the eval() function with its required value. and within this html, i want to be able to run php functions. however, due to the fact

Re: [PHP] Regular expression newbie question, convert this: [::word1 \ word2 \ word3::] to : .word1 word2 word3.

2002-06-15 Thread Analysis Solutions
Hi Lance: On Sun, Jun 16, 2002 at 01:31:45AM +0800, Lance wrote: i was developing an application that will read in the content of a html file. and within this html file contains php variables which will be replaced using the eval() function with its required value. and within this html,

Re: [PHP] Regular expression newbie question, convert this: [::word1 \ word2 \ word3::] to : .word1 word2 word3.

2002-06-14 Thread Analysis Solutions
Lance: On Fri, Jun 14, 2002 at 11:41:34PM +0800, Lance wrote: [::word1 \ word2 \ word3::] to: .word1 word2 word3. While I don't know if this is really what you need, it does do exactly what you want to do in your example: $Replace['\\'] = ''; $Replace['::'] = '.';

Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Rasmus Lerdorf
This code works fine: eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches); echo $Matches[1]; produces: WO_RD -Rasmus On Thu, 28 Mar 2002, Sharat Hegde wrote: Hello, I am still having problems with the regular expressions. Looks like there has been a change in the way they are

Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Sharat Hegde
Rasmus, The code worked fine in PHP Version 3.x It does not work with PHP Version 4.1.1. That is where I have a problem. With Regards, Sharat From: Rasmus Lerdorf [EMAIL PROTECTED] To: Sharat Hegde [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expression Problem continues

Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Miguel Cruz
Version 4.1.1. That is where I have a problem. With Regards, Sharat From: Rasmus Lerdorf [EMAIL PROTECTED] To: Sharat Hegde [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expression Problem continues Date: Thu, 28 Mar 2002 02:33:16 -0800 (PST) This code works fine

Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Rasmus Lerdorf
Hegde [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expression Problem continues Date: Thu, 28 Mar 2002 02:33:16 -0800 (PST) This code works fine: eregi(__([a-z0-9_]+)__, Hello __WO_RD__ Test, $Matches); echo $Matches[1]; produces: WO_RD -Rasmus On Thu, 28

Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Sharat Hegde
PROTECTED] To: Sharat Hegde [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expression Problem continues Date: Thu, 28 Mar 2002 12:51:44 -0600 (CST) Works for me in 4.1.1 (and 4.1.2) too. Are you sure there's not something else going on? Can you provide an unadulterated code sample

Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Rasmus Lerdorf
://www.byronholidays.com/inikatest/testereg.php To check the PHP version on the server, you can run http://www.byronholidays.com/inikatest/checkenv.php3 Regards, Sharat From: Miguel Cruz [EMAIL PROTECTED] To: Sharat Hegde [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expression

Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Sharat Hegde
. With Regards, Sharat From: Rasmus Lerdorf [EMAIL PROTECTED] To: Sharat Hegde [EMAIL PROTECTED] CC: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expression Problem continues Date: Thu, 28 Mar 2002 11:40:41 -0800 (PST) In your configure flags you have: --with-regex=system Why did you do

Re: [PHP] Regular Expression Problem continues

2002-03-28 Thread Rasmus Lerdorf
While I try and request for a recompile of the system, is there an alternate way out? Why don't you use the PCRE functions instead. The equivalent preg would be: preg_match(/__([a-z0-9_]+)__/i, Hello __WO_RD__ Test, $Matches) By the way, what is the significance of the switch

Re: [PHP] Regular Expression Challenge

2002-03-25 Thread Cameron Just
No luck on any of those suggestions people but thanks anyway :( I had a feeling it was a bit too complex for a regexp. Oh, I didnt read the bit at the bottom about the times appearing any number of times. Off the top of my head I think this should work... PREG:

Re: [PHP] Regular Expression Challenge

2002-03-25 Thread Christopher William Wesley
You won't be able to do that with a regexp alone. Recursively matching isn't possible. You'll need a little help from some additional code. ?php $string = wed-thurs 9:35, 14:56, 18:35; // YOUR STRING $regexp = ^([a-z]+)-([a-z]+)[\ ]+(.*)$; // GETS (day)-(day) (any/all

Re: [PHP] Regular Expression Challenge

2002-03-25 Thread Cameron Just
Brilliant. (Sort of) Thats the answer I needed thankyou. I was not sure as to whether regexp could do recursive matching and now I know. Thankyou for your help. You won't be able to do that with a regexp alone. Recursively matching isn't possible. You'll need a little help from some

Re: [PHP] Regular Expression Challenge

2002-03-25 Thread Matt Moreton
: [PHP] Regular Expression Challenge You won't be able to do that with a regexp alone. Recursively matching isn't possible. You'll need a little help from some additional code. ?php $string = wed-thurs 9:35, 14:56, 18:35; // YOUR STRING $regexp = ^([a-z]+)-([a-z

Re: [PHP] Regular Expression Challenge

2002-03-25 Thread Richard Archer
At 11:30 AM +1000 26/3/02, Cameron Just wrote: I was not sure as to whether regexp could do recursive matching and now I know. This is crazy! There used to be clue on this list! ?php $test = wed-thurs 9:35, 14:56, 18:35, 6, :12; $patt = /([a-z]+|[0-9]*:*[0-9]+)[ ,-]*/; if (preg_match_all

Re: [PHP] Regular Expression Challenge

2002-03-25 Thread Matt Moreton
, your way is much nicer :] - Original Message - From: Richard Archer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 26, 2002 4:04 AM Subject: Re: [PHP] Regular Expression Challenge At 11:30 AM +1000 26/3/02, Cameron Just wrote: I was not sure as to whether regexp could do

Re: [PHP] Regular Expression Challenge

2002-03-24 Thread Thalis A. Kalfigopoulos
Why a regexpr? Do one explode() on the Clean up the commas from the elements [1],[2] [3] of the returned array and on element[0] do an additional explode on - cheers, --t. On Mon, 25 Mar 2002, Cameron Just wrote: Hi, I am trying to pull out the following information via a regular

Re: [PHP] Regular Expression Challenge

2002-03-24 Thread Matt Moreton
Oh, I didnt read the bit at the bottom about the times appearing any number of times. Off the top of my head I think this should work... PREG: /'([a-z]+)-([a-z]+)\s(?:([0-9]+(?::[0-9]+|))(?:,\s)?)*'/ -- Matt - Original Message - From: Cameron Just [EMAIL PROTECTED] To: [EMAIL

RE: [PHP] Regular Expression Problem

2002-03-22 Thread Rick Emery
__([a-z0-9][a-z0-9_]+)__ -Original Message- From: Sharat Hegde [mailto:[EMAIL PROTECTED]] Sent: Friday, March 22, 2002 4:22 AM To: [EMAIL PROTECTED] Subject: [PHP] Regular Expression Problem Hello, In PHP3, I am using code which using the regular expression capability of PHP. The

Re: [PHP] regular expression

2002-03-19 Thread Thalis A. Kalfigopoulos
I guess you can do it also as: ([1-9]{3})[1-9]{3}-[1-9]{4} cheers, --t. On Tue, 19 Mar 2002, Kris Vose wrote: How would you write a regular expression that defines a phone number: ex. (123)123-1234. In other words how would you check to see if there were three numerics surrounded by

Re: [PHP] regular expression

2002-03-19 Thread Jason Wong
On Wednesday 20 March 2002 01:53, Thalis A. Kalfigopoulos wrote: I guess you can do it also as: ([1-9]{3})[1-9]{3}-[1-9]{4} But wouldn't this excludes zeros? Try: preg_match(/^\(\d{3}\)\s\d{3}-\d{4}$/, $number) which matches (123) 345-6789 -- Jason Wong - Gremlins Associates -

Re: [PHP] regular expression

2002-03-19 Thread mnc
On Tue, 19 Mar 2002, Kris Vose wrote: How would you write a regular expression that defines a phone number: ex. (123)123-1234. In other words how would you check to see if there were three numerics surrounded by (), then three numerics with a -, then four numerics. This is what I

Re: [PHP] regular expression

2002-03-19 Thread Rénald CASAGRAUDE
Kris Vose wrote: How would you write a regular expression that defines a phone number: ex. (123)123-1234. In other words how would you check to see if there were three numerics surrounded by (), then three numerics with a -, then four numerics. with posix regular expression, for

Re: [PHP] regular expression for (NOT 'word')

2002-03-16 Thread scott furt
Try this... it should only print out Some webpage data $text = script somethingscript data./script Some webpage data script somethinganother script data /script ; print preg_replace('/script (.*?)/script(.*?)\/script/', '', $text); Ando Saabas wrote: Ok let me explain my problem further

RE: [PHP] regular expression for (NOT 'word')

2002-03-14 Thread Rick Emery
the best you can do is: ?php $a = this has php in the string; if( ! ereg(php, $a ) ) { print a: not in string; } $a = this has in the string; if( ! ereg(php, $a ) ) { print b: not in string; } ? -Original Message- From: Ando Saabas [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14,

Re: [PHP] regular expression for (NOT 'word')

2002-03-14 Thread Ando Saabas
Ok let me explain my problem further some. I need the regular expression to purify the html page from script tags: I used: $file = eregi_replace((script(.*).*/script), , $file); Now this works fine, until theres a webpage like: script somethingscript data./script Some webpage data script

Re: [PHP] regular expression for (NOT 'word')

2002-03-14 Thread Michael Sims
At 05:52 PM 3/14/2002 +0200, Ando Saabas wrote: Ok let me explain my problem further some. I need the regular expression to purify the html page from script tags: I used: $file = eregi_replace((script(.*).*/script), , $file); Now this works fine, until theres a webpage like: script

Re: [PHP] Regular Expression

2002-01-03 Thread Jim Lucas [php]
I have seen this question reposted for the past week. now why don't you just work with the entire thing. get the body ... now once you have that, do this $str = preg_replace(body, , $str) $str = preg_replace(, , $str) now your $str var will only have the properties. Jim - Original

Re: [PHP] Regular Expression

2002-01-03 Thread Steve Cayford
You can do as Jim says here or go back and read the manual section again for eregi and ereg. What you're trying to do should be written more like this: ?php $str = 'body bgcolor=#ff'; $numMatches = eregi('(body)(.*)()',$str,$results); print(numMatches: $numMatches br\n); print(body

Re: [PHP] Regular Expression

2002-01-03 Thread [-^-!-%-
I apologize for the repeats. As I mentionned before, I've been having problems with this list. I believe everything is working fine, now. -john On Thu, 3 Jan 2002, Jim Lucas [php] wrote: I have seen this question reposted for the past week. now why don't you just work with the entire

Re: [PHP] Regular Expression Help

2001-12-31 Thread Brian Clark
* John Monfort ([EMAIL PROTECTED]) [Dec 31. 2001 11:30]: I'm using regular expression to extract all text within the body tag. With a BODY tag like body bgcolor= ... text= \\only interested in this line. [...] echo $out[0]; However, this prints everything following (and including) the

RE: [PHP] regular expression

2001-12-19 Thread Darren Gamble
Good day, The problem here is with the .* expression, which matches any character, including . The regex is greedy and will try and match as much as it possibly can. What you could do is change it so that it doesn't match . Then, the will be matched later in the expression,, as you want.

RE: [PHP] regular expression: THANK YOU!!!!!!

2001-12-19 Thread Darren Gamble
. Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948 -Original Message- From: Wakan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 10:21 AM To: Darren Gamble Subject: RE: [PHP] regular expression

Re: [PHP] Regular Expression

2001-11-13 Thread Jason G.
I am just learning them, but I think something like this may be in order... I know that you would use the | (or) operator. if(! (ereg('^[a-z|A-Z|0-9|\-]+$', $fn) (ereg('^[a-z|A-Z|0-9|\-]+$', $fs))) { Either $fn or $sn failed the match } -Jason Garber IonZoft.com At 04:41 PM

Re: [PHP] Regular Expression

2001-11-13 Thread Andrey Hristov
Subject: Re: [PHP] Regular Expression I am just learning them, but I think something like this may be in order... I know that you would use the | (or) operator. if(! (ereg('^[a-z|A-Z|0-9|\-]+$', $fn) (ereg('^[a-z|A-Z|0-9|\-]+$', $fs))) { Either $fn or $sn failed the match } -Jason

Re: [PHP] Regular expression question

2001-11-09 Thread Jack Dempsey
What is $num going to be? A number? So how do you determine where that number ends and where there shouldn't be another number in front of it...are there any restrictions on the size of $num? say $num is 51 then you're saying that you want to match 51:: but not 151:: however, what if $num is

Re: [PHP] regular expression

2001-11-01 Thread Christian Reiniger
On Thursday 01 November 2001 10:39, Galkov Vladimir wrote: Need to remove all ../ /.. from user inputing string to prevent him walking and creating filesdirectories where I don't whant see them/him... The string: $path =

Re: [PHP] regular expression

2001-11-01 Thread DL Neil
(placed in the appropriate directory) contravene the specification? =dn - Original Message - From: Christian Reiniger [EMAIL PROTECTED] To: Galkov Vladimir [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: 01 November 2001 11:50 Subject: Re: [PHP] regular expression On Thursday 01 November 2001

Re: [PHP] Regular Expression Problem and PHP 4 (urgent) --- continued

2001-08-30 Thread Ross Nielsen
Andrey, Thanks for the time that you put into this! After some tweaking (for my scripts) I got this working nicely, and learned a thing or two about PREG also. Ross Nielsen [EMAIL PROTECTED] Andrey Hristov [EMAIL PROTECTED] wrote in message

Re: [PHP] Regular Expression Problem and PHP 4 (urgent) --- continued

2001-08-27 Thread Andrey Hristov
Some time spent to try but now i think it works: ?php echo pre; $a='datadatadatadata[link1]datadatadata{link2}data[link3]'; // $a='datadata{link1}data[link2]datadatadata{link3}data[link4]'; $pattern='/((\[)|\{)(.+?)(?(2)\]|\})/'; echo $a.\n; echo $pattern.\n;

RE: [PHP] Regular Expression Question

2001-07-25 Thread Seb Frost
since you know exactly which 4 characters you want to keep you can use a simple string trimming routine. $newstring = substr($string,1,5); No need for complicated regular expressions! - seb -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: 25 July 2001 21:47 To: PHP

RE: [PHP] Regular Expression Question correction

2001-07-25 Thread Seb Frost
$newstring = substr($string,1,4); FOUR, not FIVE. Doh. -Original Message- From: Seb Frost [mailto:[EMAIL PROTECTED]] Sent: 25 July 2001 22:03 To: [EMAIL PROTECTED]; PHP Subject: RE: [PHP] Regular Expression Question since you know exactly which 4 characters you want to keep you can

RE: [PHP] Regular Expression Question

2001-07-25 Thread Jeff Oien
Aren't the trims just for white space? Jeff Oien since you know exactly which 4 characters you want to keep you can use a simple string trimming routine. I forget the name of the function in php but it's there and it'll be something like trimstring($string,1,5); or something like that.

RE: [PHP] Regular Expression Question

2001-07-25 Thread Seb Frost
I hope my later message clarifys what I mean. - seb -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: 25 July 2001 22:05 To: PHP Subject: RE: [PHP] Regular Expression Question Aren't the trims just for white space? Jeff Oien since you know exactly which 4

RE: [PHP] Regular Expression Question

2001-07-25 Thread Matthew Loff
PROTECTED]] Sent: Wednesday, July 25, 2001 5:09 PM To: [EMAIL PROTECTED]; PHP Subject: RE: [PHP] Regular Expression Question I hope my later message clarifys what I mean. - seb -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: 25 July 2001 22:05 To: PHP Subject: RE: [PHP

Re: [PHP] Regular expression, parsing bad html in a xml document (strange)

2001-07-12 Thread Francis Fillion
Lazy me, after a short break, alway's helping, I found out wthat it has to be: /\(?!\?xml|\!DOCTYPE|\!ENTITY|image|item|\/item)/ the ?! negate this text, I though that I could put it in every value like this (?!\?xml|?!\!ENTITY ... but no by putting in first he do it for all (k.i.s.s.

RE: [PHP] Regular Expression help

2001-07-02 Thread scott [gts]
try something like this: $emails = array('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]'); $doms = array( 'domain1.com'=1, 'domain2.com'=1, ); while ( list(,$email) = each($emails) ) {

Re: [PHP] Regular Expression Help

2001-05-22 Thread Mark Maggelet
On Tue, 22 May 2001 10:44:42 -0700, Jason Caldwell ([EMAIL PROTECTED]) wrote: I'm trying to figure out how to say with a Regular Expression how to check for the following characters in a phone number: ( ) - with a length between 1 and 20 -- I've tried the following and it doesn't seem to work.

Re: [PHP] Regular Expression Help

2001-05-22 Thread Christian Reiniger
On Tuesday 22 May 2001 19:44, Jason Caldwell wrote: I'm trying to figure out how to say with a Regular Expression how to check for the following characters in a phone number: ( ) - with a length between 1 and 20 -- preg_match ('/^[\d()-]{1,20}$/', $Subject) should do the trick. --

Re: [PHP] Regular Expression

2001-04-19 Thread Christian Reiniger
On Wednesday 18 April 2001 22:55, you wrote: oops. The expression should read '/\[([^\]]+)\]/' Thanks all, i used this code and it works: preg_match("/\[(.+)\]/",$msg_array[$i],$segments); Note: This won't do what you expect, since the ".+" part will match as much as possible.

Re: [PHP] Regular Expression

2001-04-18 Thread Wico de Leeuw
At 13:39 18-4-2001 +0200, Jeroen Geusebroek wrote: Hi, I have question about regular expressions; I don't know anything about it and was wondering if someone could help me out. I have this text: "[ this is atest ] and this is the rest of the text" $data = "[ this is a test ] and this is the

Re: [PHP] Regular Expression

2001-04-18 Thread Christian Reiniger
On Wednesday 18 April 2001 13:39, you wrote: I have this text: "[ this is atest ] and this is the rest of the text" I want to get the text inbetween the [ and ]. if (preg_match ('/\[([^\]])\]/', $Subject, $Matches)) { echo "Found it : '" . $Matches [1] . "'"; } looks a bit perverse

Re: [PHP] Regular Expression

2001-04-18 Thread Christian Reiniger
On Wednesday 18 April 2001 17:07, you wrote: On Wednesday 18 April 2001 13:39, you wrote: I have this text: "[ this is atest ] and this is the rest of the text" I want to get the text inbetween the [ and ]. if (preg_match ('/\[([^\]])\]/', $Subject, $Matches)) { echo "Found it :

<    1   2   3   4   >