Re: [PHP] Can someone help me build a regular expression?

2005-05-02 Thread Jason Sweeney
Give this a shot:
   ^[0-9]{2,3}\.[0-9]$
Returns regex that begins with 2-3 digits, followed by a period, and 
ends with one digit.

jason sweeney
jason.designshift.com
[EMAIL PROTECTED] wrote:
Hi All,
I've sucessfully got a JavaScript validating some text boxes to make
sure that only numbers exist.I cheated and downloaded a regular
expression someon else had used and that works nicely.  I wish to
validate the text box in the format of:
xXX.X
With the upper case Xs being a required number and the lower case x
being allowed but not needed.
Can anybody help me?

Ta
Matthew



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Can someone help me build a regular expression?

2005-05-02 Thread mwestern
Thanks to all that posted with help.   I've got a book about regular
expressions but it's all very new to me. 

-Original Message-
From: Jason Sweeney [mailto:[EMAIL PROTECTED] 
Sent: Monday, 2 May 2005 9:50 PM
To: Matthew Western, IT Support, Lonsdale
Cc: php-general@lists.php.net
Subject: Re: [PHP] Can someone help me build a regular expression?

Give this a shot:

^[0-9]{2,3}\.[0-9]$

Returns regex that begins with 2-3 digits, followed by a period, and
ends with one digit.

jason sweeney
jason.designshift.com


[EMAIL PROTECTED] wrote:
 Hi All,
 
 I've sucessfully got a JavaScript validating some text boxes to make
 sure that only numbers exist.I cheated and downloaded a regular
 expression someon else had used and that works nicely.  I wish to
 validate the text box in the format of:
 
 xXX.X
 
 With the upper case Xs being a required number and the lower case x 
 being allowed but not needed.
 
 Can anybody help me?
 
 Ta
 Matthew
 
 
 
 
 
 
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] can someone help?

2002-04-24 Thread Miguel Cruz

You're just trying to print a list of words, one per line?

  print join('br', explode(' ', 'Why am I trying?'));

or, broken into steps in case you want to deal more with the array:

  $ar = explode(' ', 'Why am I trying?');
  foreach ($ar as $word)
  {
print br$word;
  }

I didn't look that carefully at your code because it was making my head 
hurt. Perhaps if you can explain better what you're trying to achieve (if 
the computer can't figure it out, neither can we) then I could provide 
more specific and helpful advice.

miguel

On Wed, 24 Apr 2002, Kirk Babb wrote:

 First, here's my code:
 ?php
 $string=Why am I trying to do this crazy stuff when I should know
 better?;
 $array=preg_split([\s], $string);
 // just a test of the preg_split results
 // print_r($array);
 $i=0;
 $count = count($array);
 $container=0;
 while ($container = 20) {
 $box = strlen($array[$i]);
 $container=$container + $box;
 $i++;
 }
 $returned_string=;
 $j=0;
 while ($j = $i) {
 $returned_string .= $array[$j] .  ;
 $j++;
 }
 print $returned_string . br;
 ?
 Works great on the first line, but I'm stuck on printing the remaining part
 of the array using some sort of loop.  I've tried a few things but get
 endless loops.  In the end I'd like to make this a function and just give it
 the string and the container length as arguments.can someone give me
 some advice?
 
 THANKS! :)
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] can someone help?

2002-04-24 Thread Maxim Maletsky \(PHPBeginner.com\)


Hey, I started playing with your code for a while ... And then
realized.. What you're trying to do it to reproduce chunk_split()
function.
Try other work arounds for this.

Read the docs,
Start from here: www.php.net/chunk_split


Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins




-Original Message-
From: Kirk Babb [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, April 24, 2002 5:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] can someone help?


First, here's my code:
?php
$string=Why am I trying to do this crazy stuff when I should know
better?;
$array=preg_split([\s], $string);
// just a test of the preg_split results
// print_r($array);
$i=0;
$count = count($array);
$container=0;
while ($container = 20) {
$box = strlen($array[$i]);
$container=$container + $box;
$i++;
}
$returned_string=;
$j=0;
while ($j = $i) {
$returned_string .= $array[$j] .  ;
$j++;
}
print $returned_string . br;
?
Works great on the first line, but I'm stuck on printing the remaining
part of the array using some sort of loop.  I've tried a few things but
get endless loops.  In the end I'd like to make this a function and just
give it the string and the container length as arguments.can someone
give me some advice?

THANKS! :)



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Can someone help me parse XML? - Challenge

2001-09-18 Thread Christian Reiniger

On Monday 17 September 2001 16:42, Jeff Lewis wrote:
 I have an XML file that I need to parse.  I had the base of a perl
 script written but wasn't completely functioning and was hoping someone
 could give me a hand with making it parse and do what it's supposed to
 but in PHP.  The perl file looked like this:

http://php.net/manual/en/ref.xml.php

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

I sat laughing snidely into my notebook until they showed me a PC running
Linux. And oh! It was as though the heavens opened and God handed down a
client-side OS so beautiful, so graceful, and so elegant that a million
Microsoft developers couldn't have invented it even if they had a hundred
years and a thousand crates of Jolt cola.

- LAN Times

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]