Re: [PHP] Regexp help (simple)

2004-01-21 Thread Victor Spång Arthursson
2004-01-20 kl. 10.41 skrev Dagfinn Reiersl: [EMAIL PROTECTED] wrote: $string = 'ab12345-1'; if (preg_match('/^([a-z]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/i', $string, $m='')) { echo $m[1]; // - ab echo $m[2]; // - 12345-1 } g. martin luethi You can replace {0,1} with a question mark and

Re: [PHP] Regexp help (simple)

2004-01-20 Thread php
$string = 'ab12345-1'; if (preg_match('/^([a-zåäö]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/i', $string, $m='')) { echo $m[1]; // - ab echo $m[2]; // - 12345-1 } g. martin luethi Tue, 20 Jan 2004 09:59:37 +0100 Victor Spång Arthursson [EMAIL PROTECTED]: Hi! Anyone who could help me with

Re: [PHP] Regexp help (simple)

2004-01-20 Thread Dagfinn Reiersøl
[EMAIL PROTECTED] wrote: $string = 'ab12345-1'; if (preg_match('/^([a-zåäö]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/i', $string, $m='')) { echo $m[1]; // - ab echo $m[2]; // - 12345-1 } g. martin luethi You can replace {0,1} with a question mark and [0-9] with \d (digit). Also, and I think

Re: [PHP] regexp with mysql

2004-01-15 Thread Lowell Allen
i hope someone can help it should be easy but i still don't get it. i have a field which has numbers seperated via a comma for example 1,2,3,12,14,23,51 now if i was to do a search for a the rows that has '2' in it i do SELECT * FROM table WHERE ids REGEXP 2 will it show fields that

Re: [PHP] regexp with mysql

2004-01-15 Thread Toby Irmer
i guess SELECT * FROM `table` WHERE ids REGEXP ',2,|^2,|,2$' should do it... hth toby - Original Message - From: Lowell Allen [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 4:39 PM Subject: Re: [PHP] regexp with mysql i hope someone can help

Re: [PHP] regexp with mysql

2004-01-15 Thread CPT John W. Holmes
, January 15, 2004 10:48 AM Subject: Re: [PHP] regexp with mysql i guess SELECT * FROM `table` WHERE ids REGEXP ',2,|^2,|,2$' should do it... hth toby - Original Message - From: Lowell Allen [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Thursday, January 15, 2004 4:39

Re: [PHP] Regexp (ereg) help

2003-07-24 Thread Curt Zirzow
* Thus wrote Reuben D. Budiardja ([EMAIL PROTECTED]): Hi all, If I have the following string: $str = This is a %ANS[1] test, and %ANS[2] test, and %ANS[10], test and want to use ereg($pattern, $str, $regs); what is the $pattern should be so that in $regs I have $regs[1] == %ANS[1];

Re: [PHP] regexp help...

2003-07-21 Thread Doug La Farge
I guess I should point out that the line i want is the XML line '?xml..' On Monday, July 21, 2003, at 11:44 AM, Doug La Farge wrote: Hi all, I have a string that for all practical purposes should probably be a list (array). I need one line from the string and need to send the rest to

Re: [PHP] regexp problem

2003-07-11 Thread Burhan Khalid
On Thursday, July 10, 2003, 9:25:31 PM, Taylor wrote: TY First, TY I need the code to replace the link in a string, like TY BASE HREF=www.google.com with BASE HREF=mystring TY ereg_replace('BASE HREF=\'(.*)'\', 'BASE HREF=\$my_string\', TY $old); TY That was the closest i got, but (.*) makes

RE: [PHP] regexp for URL

2003-06-09 Thread Boaz Yahav
Try this : How to use regular expressions to get the list of links from an HTML page http://examples.weberdev.com/get_example.php3?count=1401 extract_links(); Extract all local links from a URL http://examples.weberdev.com/get_example.php3?count= Sincerely berber Visit

Re: [PHP] regexp for URL

2003-06-08 Thread David Otton
On Mon, 09 Jun 2003 07:13:43 +0200, you wrote: Does anyone have a good regular expression for capturing all http URL in a string? now i'm using ?(http://[a-z0-9-/_;=+-\.\?:@]+)\b?mi in one of my programs, that is, all strings beginning with http:// and contain chars like a-z0-9 ... does anione

Re: [PHP] Regexp question...

2003-05-28 Thread David Grant
Andrew D. Luebke wrote: OK, here is the regexp command I am trying to use: $split_filename = preg_split('/\./', $_FILES[userfile][name], -1); However, when I do a count($split_filename) I don't get what I expect. For instance if the input is: abc.xyz.123 I get 2 from count, why

RE: [PHP] [RegExp] extracting anchors

2003-03-13 Thread Boaz Yahav
Try these two : A function that parses a string and replaces http://whatever with a link, and email addresses with a mailto link. This function was designed for the motd package. But will work freely on its own. http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=1235 How to change

Re: [PHP] RegExp for Forum-List-Code

2002-11-09 Thread Marek Kilimajer
untested: preq_replace('/\[\*\]([^(\[\*\])(\/ul)]*)/i','li$1/li',$text); Jens Lehmann wrote: Hi out there, I encountered a lot of problems while trying to convert a list in Forum-Code (like UBB-Code). [list] [*] item 1 [*] item 2 [*] item 3 [/list] should be converted to ul liitem 1/li

Re: [PHP] RegExp for Forum-List-Code

2002-11-09 Thread Jens Lehmann
That's what I thought, too. But it doesn't work. test.php: $text = 'ul [*] jusfj [*] ijusnf [*] jsf [*] jusdf /ul'; $text = preg_replace('/\[\*\]([^(\[\*\])(\/ul)]*)/i','li$1/li',$text); $text = htmlentities($text); Output: ul li j/liusfj li ij/liusnf li jsf /lili j/liusdf /ul I tested some

Re: [PHP] RegExp for Forum-List-Code

2002-11-09 Thread Ernest E Vogelsinger
At 17:19 09.11.2002, Jens Lehmann said: [snip] Hi out there, I encountered a lot of problems while trying to convert a list in Forum-Code (like UBB-Code). [list] [*] item 1 [*] item 2 [*] item 3 [/list] should be converted to ul liitem 1/li liitem 2/li

Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Analysis Solutions
On Thu, Jul 11, 2002 at 06:41:28PM -0400, Monty wrote: I'm trying to preg_split() text between page. I used the following but can't get the regular expression to work: $content = blah blah page blah blah blah; $paged = preg_split( [[:cntrl:]*]page[[:cntrl:]*], $content ); The * needs to be

Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Monty
The * needs to be after the character class, ie [[:cntrl:]]*. --Dan Thanks Dan. But, removing the asterisk or putting it after the character class doesn't work either for some reason. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Analysis Solutions
On Thu, Jul 11, 2002 at 07:33:59PM -0400, Monty wrote: Thanks Dan. But, removing the asterisk or putting it after the character class doesn't work either for some reason. Have you tried [[:space:]]* instead? That'll pull in line breaks, tabs and spaces. --Dan -- PHP

Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Monty
Have you tried [[:space:]]* instead? That'll pull in line breaks, tabs and spaces. --Dan I just tried it, but, still can't make this work. Also, I'm getting different results between explode() and preg_split(), is that normal? Here's what I'm trying: $content = blah blah page_break

Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Analysis Solutions
On Thu, Jul 11, 2002 at 11:24:34PM -0400, Monty wrote: $contentpage = preg_split([[:space:]]*page_break[[:space:]]*, $content); DOH! It's preg!!! [[:space:]] is for ereg. Use \s. I don't know why I didn't notice sooner. Do this: '/\s*page_break\s*/' --Dan -- PHP

Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Monty
Yes! That was it! Thank you so much. I actually thought preg and ereg were interchangeable, so, I'm glad you pointed out the difference for reg expressions. Can you tell me what the open and closing slashes / are for inside the quotes? Is it equivalent to [ and ] for ereg? Monty DOH! It's

Re: [PHP] RegExp Help: [:cntrl:] not working

2002-07-11 Thread Analysis Solutions
On Fri, Jul 12, 2002 at 12:08:36AM -0400, Monty wrote: expressions. Can you tell me what the open and closing slashes / are for inside the quotes? Is it equivalent to [ and ] for ereg? They are delimiters. Other characters can be used, but / is the standard. --Dan -- PHP

Re: [PHP] RegExp - Replacing 'RB' with 'RB'

2002-06-11 Thread Michael Weinberger
$x = preg_replace( /([^\s])([^\s])/, $1$2, $x ); should do the job. Michael Neil Freeman [EMAIL PROTECTED] schrieb: Hi, For all you Unix gurus this should be run of the mill stuff but us Windows boys tend to get confused easily :) How can I easily match occurrences of text along the

Re: [PHP] RegExp - Replacing 'RB' with 'RB'

2002-06-11 Thread Neil Freeman
That's perfect Michael. Thanks a lot for your help :) Neil Michael Weinberger wrote: ** This Message Was Virus Checked With : SAVI 3.58 May 2002 Last Updated 11th June 2002

Re: [PHP] regexp magic

2002-05-28 Thread Lars Torben Wilson
On Tue, 2002-05-28 at 16:56, Dan Harrington wrote: Greetings everyone, I'm trying to do some regexp magic and just can't seem to get it done with PHP. Basically I want to evaluate a word and if the last character of the word is an 's', to knock it off, unless there are two consecutives

RE: [PHP] regexp for ' replacement

2002-04-05 Thread Rick Emery
addslashes($textline) -Original Message- From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:54 AM To: [EMAIL PROTECTED] Subject: [PHP] regexp for ' replacement Yet another regexpr question. If I have as part of a text: ...and then 'the quick brown

RE: [PHP] regexp for ' replacement

2002-04-05 Thread Thalis A. Kalfigopoulos
Nop. I don't want to affect the first and last ' of every line. On Fri, 5 Apr 2002, Rick Emery wrote: addslashes($textline) -Original Message- From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 10:54 AM To: [EMAIL PROTECTED] Subject: [PHP]

RE: [PHP] regexp for ' replacement

2002-04-05 Thread Rick Emery
to you\' $z= 'here\'s to you' -Original Message- From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 11:35 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: RE: [PHP] regexp for ' replacement Nop. I don't want to affect the first and last ' of every line

RE: [PHP] regexp on user supplied link

2002-02-20 Thread SpamSucks86
-Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 6:59 PM To: '[EMAIL PROTECTED]'; php Subject: RE: [PHP] regexp on user supplied link reg.ex. something like (not tested): a[^]* this would give you the entire anchor tag, then go from

Re: [PHP] regexp on user supplied link

2002-02-20 Thread DL Neil
. Regards, =dn - Original Message - From: SpamSucks86 [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: 20 February 2002 21:16 Subject: RE: [PHP] regexp on user supplied link I absolutely hate regular expressions because I suck at writing them...but I can help you with the logic. I

RE: [PHP] regexp on user supplied link

2002-02-19 Thread Martin Towell
reg.ex. something like (not tested): a[^]* this would give you the entire anchor tag, then go from there? or what about using the XML parsing routines, get it to find the anchors and give you it's attributes, then go from there? Martin -Original Message- From: Justin French

[PHP] Re: PHP regexp powerful?

2001-09-07 Thread _lallous
Are they powerful? Well they are compatible with PERL's Regular expressions...you should use the 'preg_' functions... Check the manual anyway...: http://www.php.net/manual/en/ref.pcre.php Jeff Lewis [EMAIL PROTECTED] wrote in message

Re: [PHP] REGEXP

2001-07-19 Thread Sheridan Saint-Michel
I am not sure if I am understanding you... but if you just want to return the boundary try preg_match(|boundary=\([^\].+)\|Uis, $text, $regs ); $boundary = $regs[1]; I am guessing that you want the boundary from the lines to avoid regexp (too lazy) but now I want to use it. The final result I

RE: [PHP] REGEXP

2001-07-18 Thread Ben Bleything
Why don't you explode(;,$header); ?? Ben -Original Message- From: Adrian D'Costa [mailto:[EMAIL PROTECTED]] Sent: Saturday, July 14, 2001 2:54 AM To: php general list Subject: [PHP] REGEXP Hi, I am trying to capture the Header from a mail for my webmail using php and pop3. The

RE: [PHP] regexp. king needed (is it possible ???)

2001-07-17 Thread Adrian Ciutureanu
? $s = 'somthing opentag1 .any content in between .. closetag1 somthing else'; $opentag = 'opentag1'; $closetag = 'closetag1'; $other_content = 'the other content'; $content = ereg_replace(.*$opentag, '', ereg_replace($closetag.*, '',

Re: [PHP] regexp. king needed (is it possible ???)

2001-07-17 Thread Jeroen Olthof
thanks my king :) it works !!! Adrian Ciutureanu [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ? $s = 'somthing opentag1 .any content in between . closetag1 somthing else'; $opentag = 'opentag1'; $closetag = 'closetag1'; $other_content =

Re: [PHP] regexp question - extracting wanted ascii characters only?

2001-04-04 Thread Christian Reiniger
On Wednesday 04 April 2001 11:23, you wrote: Is it possible through the regexp to specify that I only want some of the ASCII characters from the binary stream? Here is the perl equivalent: /([\040-\176\s]{3,})/g I want only those words that are minimum 3 characters and I want the

RE: [PHP] regexp question - extracting wanted ascii characters only?

2001-04-04 Thread Jorg Krause
From: Erick Papadakis [mailto:[EMAIL PROTECTED]] Hi, I need to do a simple thing. I want to read a binary file (e.g., microsoft word, excel etc) and then extract only the text from it. I am using simple fopen() and fread() and when I print out the contents of the file, it returns me

Re: [PHP] Regexp

2001-03-29 Thread CC Zona
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("David Balatero") wrote: So, I guess i need a regexp to remove all the \n and :space: chars. Here are some ideas: $out=preg_replace("/\s+/","",$in); //strip whitespace or $out=preg_replace("/\s+/"," ",$in); //replace whitespace with single

Re: [PHP] regexp on us tele number

2001-03-23 Thread Christian Reiniger
On Thursday 22 March 2001 16:17, you wrote: i'm still getting the hang of regexps, however i have on small problem - I can't seem to make one to work on a US telephone number. does anyone have something similar that i could work from? Well, how does/can a US telephone number look like? --

Re: [PHP] RegExp help..

2001-03-12 Thread Fredrik Wahlberg
Try this: $ ereg("^([0-9]{2})[0-9]{2}([0-9]{2}).*", $var, $hits) if ($hits[1] == themonth $hits[2] == theyear) { do_the_stuff } What it does is that it puts the first two digitst into $hits[1], skips the two nextcoming digits and finally puts the next two numbers into $hits[2]

<    1   2