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 te

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

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 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-22 Thread Victor Spång Arthursson
2004-01-22 kl. 10.40 skrev Dagfinn Reiersøl: 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 Dagfinn Reiersøl
Victor Spång 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})$/ i',$bo

Re: [PHP] Regexp help (simple)

2004-01-21 Thread Victor Spång Arthursson
2004-01-20 kl. 10.41 skrev 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 a

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 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 m

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 ' 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 /dev/null. Th

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: [: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 pre

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 cl

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_brea

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 cl

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 06:41:28PM -0400, Monty wrote: > I'm trying to preg_split() text between "". I used the following but > can't get the regular expression to work: > > $content = "blah blah blah blah blah"; > $paged = preg_split( "[[:cntrl:]*][[:cntrl:]*]", $content ); The * needs to be a

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] /Fred

Re: [PHP] RegExp help..

2001-03-11 Thread David Robley
On Mon, 12 Mar 2001 12:10, John Vanderbeck wrote: > 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 file name in the format MMDDYY-*.txt...I need to parse it to > determine if the month and yea