[PHP] Regexp help second

2005-01-06 Thread Uro Gruber
Hi! Last help about regexp solve my problem, but I have another one. I've made some regexp but it does not work always Let say I have some strings 1) this is some domain.com test 2) domain.com I can make this work either for first example of fo second, but not for both. What I want is replace of

Re: [PHP] Regexp help second

2005-01-06 Thread Richard Lynch
You could maybe cheat and add an X at the beginning and end of the string before your Regex, then you will have: X\1 \2 \3X and you can strip off the initial X from \1 and the trailing X from \3 There's probably some fancy Regexp way to do it though. Uroš Gruber wrote: Hi! Last help about

Re: [PHP] Regexp help second

2005-01-06 Thread Andrew Kreps
On Thu, 06 Jan 2005 13:50:58 +0100, Uro Gruber [EMAIL PROTECTED] wrote: 1) this is some domain.com test 2) domain.com I can make this work either for first example of fo second, but not for both. What I want is replace of domain.com to get this is dome domain.com domain com test so

[PHP] Regexp help

2004-10-20 Thread Chris Boget
What would the regex look like to accept *any* character for a value but the total length of the value can be no greater than 50 characters. The regex I am trying to use is as follows ^[\d\D\w\W\s\S.]{0,50}$ but it doesn't appear to be working... Any ideas? thnx, Chris -- PHP General Mailing

Re: [PHP] Regexp help

2004-10-20 Thread John Holmes
From: Chris Boget [EMAIL PROTECTED] Subject: [PHP] Regexp help What would the regex look like to accept *any* character for a value but the total length of the value can be no greater than 50 characters. The regex I am trying to use is as follows ^[\d\D\w\W\s\S.]{0,50

Re: [PHP] Regexp help (simple)

2004-01-22 Thread Dagfinn Reiersl
Victor Spng Arthursson wrote: Have been playing around a bit with this code, but I can't get it to work with international characters For example, if I feed my function: function split_bokid($bokid) { if (preg_match('/^([a-z]{2,3})([0-9]{4,5}(\-[0-9]{1,2}){0,1})$/

Re: [PHP] Regexp help (simple)

2004-01-22 Thread Victor Spång Arthursson
2004-01-22 kl. 10.40 skrev Dagfinn Reiersl: I assume you mean: $test = split_bokid(12345); Yes! I don't know. It works fine on my computer. The letters display correctly on the command line and even in Mozilla. Hmmm try the following:

Re: [PHP] Regexp help (simple)

2004-01-22 Thread Martin Luethi
maybe this work: replace the special-characters first, eg.: $bokid = str_replace(å, _, $bokid); and replace them back after preg_match or try the preg_match with the hexcode of this special chars: \xhh character with hex code hh (http://ch2.php.net/manual/de/pcre.pattern.syntax.php) g. martin

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

[PHP] Regexp help (simple)

2004-01-20 Thread Victor Spång Arthursson
Hi! Anyone who could help me with this regexp problem? I want to verify that a string is made up of 2-3 letters, (a-z + åäö, A-Z + ÅÖÄ), directly followed by 4 or 5 digits, which could, but may not, be followed by a minus and one or two digits. Examples of valid strings: abc12345 ABC12345

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

[PHP] regexp help please!

2003-09-21 Thread Justin French
I'm writing a PHP script inspired by smartypants and textile (but for PHP), which among other things does smart quoting. However, I want to avoid smart quotes inside all tags (all quotes inside and ). Since there are numerous functions accounting for numerous special cases, AND the fact that

[PHP] regexp help...

2003-07-21 Thread Doug La Farge
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 /dev/null. The string starts: HTTP/1.1 200 OK Date: Tue, 22 Jul 2003 01:34:12 GMT Server: Apache/1.3.27 (Unix) mod_jk/1.1.0 mod_ssl/2.8.12

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

[PHP] regexp help wanted

2002-09-28 Thread Thomas Seifert
Hi folks, I just got nuts by trying to find a regexp for use with preg_replace to achive the following: remove all br / which are in the text between a pre and a /pre Tag. So, I want no br between these tags. Any ideas or quick help? thanks in advance, Thomas -- PHP General Mailing List

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

2002-07-11 Thread Monty
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 ); I also tried the following... $content = blah blah page blah blah blah;

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 help..

2001-03-12 Thread Fredrik Wahlberg
to $hits[2] /Fredrik Ursprungligt meddelande John Vanderbeck [EMAIL PROTECTED] skrev 2001-03-12, kl. 02:40:25 angende mnet [PHP] RegExp help..: I really wish I could figure these darn things out :) I have a task I need to do, and i'm certain I could do this easily with a regexp.. I have a