Re: [PHP] Re: Regex help

2008-09-09 Thread Jason Pruim


On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:


Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know regex's   
better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112 to  
purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
   RewriteRule /(.*) /volumes/raider/webserver/ 
documents/dev/schreurprinting.com/p.php?purl=$

#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) / 
purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question is  
much more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be fairly  
simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]


Just tried it, and it pops up with a 404... I'll keep looking.

One other thing that I should probably add is the fact that the  
^jasonpruim112$ could have hundreds of counterparts ^bobsmith112$  
^jerrybob112$ etc... etc...


Thanks for looking though!



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Re: Regex help

2008-09-09 Thread Nathan Rixham

Jason Pruim wrote:


On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:


Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know regex's  
better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112 to 
purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
   RewriteRule /(.*) 
/volumes/raider/webserver/documents/dev/schreurprinting.com/p.php?purl=$ 


#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) 
/purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question is much 
more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be fairly 
simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]


Just tried it, and it pops up with a 404... I'll keep looking.

One other thing that I should probably add is the fact that the 
^jasonpruim112$ could have hundreds of counterparts ^bobsmith112$ 
^jerrybob112$ etc... etc...


Thanks for looking though!



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]




here's a typical rule; probably best to modify what works and go from 
there :)


RewriteRule ^directory/(.*)$ /newdirectory/$1 [L]

the other alternative is to let php handle it..
this is basicaly if request isn't a file or a directory route to a php 
handler [my prefered way]:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /notfound_handler.php [L]

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



Re: [PHP] Re: Regex help

2008-09-09 Thread Per Jessen
Jason Pruim wrote:

 
 On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:
 
 Jason Pruim wrote:
 Hey everyone,
 Not completely specific to php but I know you guys know regex's
 better then I do! :)
 I am attempting to match purl.schreurprinting.com/jasonpruim112 to
 purl.schreurprinting.com/p.php?purl=jasonpruim112
 Here are my current matching patterns:
RewriteRule /(.*) /volumes/raider/webserver/
 documents/dev/schreurprinting.com/p.php?purl=$
 #   RewriteRule /(*.) /purl.schreurprinting.com/$1
 #   RewriteRule /(mail.php?purl=*) /
 purl.schreurprinting.com/mail.php?purl=$1
 Yes I am doing this for apache's mod_rewrite, but my question is
 much more specific to regex's at this point :)
 Any ideas where I am going wrong? it seems like it should be fairly
 simple to do, but I don't know regex's at all :)
 --
 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 11287 James St
 Holland, MI 49424
 www.raoset.com
 [EMAIL PROTECTED]

 RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]
 
 Just tried it, and it pops up with a 404... I'll keep looking.
 
 One other thing that I should probably add is the fact that the
 ^jasonpruim112$ could have hundreds of counterparts ^bobsmith112$
 ^jerrybob112$ etc... etc...
 

Maybe this:

RewriteCond %{REQUEST_URI} !^/p\.php
RewriteRule ^/(.+)$ /p.php?purl=$1


/Per Jessen, Zürich


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



Re: [PHP] Re: Regex help

2008-09-09 Thread Jason Pruim


On Sep 9, 2008, at 5:02 PM, Nathan Rixham wrote:


Jason Pruim wrote:

On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:

Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know regex's   
better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112  
to purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
  RewriteRule /(.*) /volumes/raider/webserver/ 
documents/dev/schreurprinting.com/p.php?purl=$

#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) / 
purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question is  
much more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be  
fairly simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]

Just tried it, and it pops up with a 404... I'll keep looking.
One other thing that I should probably add is the fact that the  
^jasonpruim112$ could have hundreds of counterparts  
^bobsmith112$ ^jerrybob112$ etc... etc...

Thanks for looking though!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]

here's a typical rule; probably best to modify what works and go  
from there :)


RewriteRule ^directory/(.*)$ /newdirectory/$1 [L]

the other alternative is to let php handle it..
this is basicaly if request isn't a file or a directory route to a  
php handler [my prefered way]:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /notfound_handler.php [L]


Interesting idea... I hadn't thought about that... Then I could just  
use a regex in php and grab everything after the domain name and pass  
it to my database to search and find the appropriate info to pull out...


I'll have to do some searching :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Re: Regex help

2008-09-09 Thread Jochem Maas

Jason Pruim schreef:


On Sep 9, 2008, at 5:02 PM, Nathan Rixham wrote:


Jason Pruim wrote:

On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:

Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know regex's  
better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112 to 
purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
  RewriteRule /(.*) 
/volumes/raider/webserver/documents/dev/schreurprinting.com/p.php?purl=$ 


#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) 
/purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question is 
much more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be fairly 
simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]

Just tried it, and it pops up with a 404... I'll keep looking.
One other thing that I should probably add is the fact that the 
^jasonpruim112$ could have hundreds of counterparts ^bobsmith112$ 
^jerrybob112$ etc... etc...

Thanks for looking though!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]

here's a typical rule; probably best to modify what works and go from 
there :)


RewriteRule ^directory/(.*)$ /newdirectory/$1 [L]

the other alternative is to let php handle it..
this is basicaly if request isn't a file or a directory route to a php 
handler [my prefered way]:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /notfound_handler.php [L]


RewriteRule . /notfound_handler.php [L,QSA]

the QSA tells apache to to automatically append any query string, saves
the hassle of having to deal with it in the regexp (assuming you might need it)

also beware that external redirects will cause POSTs to become GETs so that
the script/code in question never recieves the POST.



Interesting idea... I hadn't thought about that... Then I could just use 
a regex in php and grab everything after the domain name and pass it to 
my database to search and find the appropriate info to pull out...


your probably wanting the info in $_SERVER['REQUEST_URI'] ... which is
the complete uri before it was rewritten.

also check this func out, will probably spare you the regexp completely:

http://php.net/manual/en/function.parse-url.php



I'll have to do some searching :)


always ;-)





--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]








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



Re: [PHP] Re: Regex help

2008-09-09 Thread Jason Pruim


On Sep 9, 2008, at 12:18 PM, Jochem Maas wrote:


Jason Pruim schreef:

On Sep 9, 2008, at 5:02 PM, Nathan Rixham wrote:

Jason Pruim wrote:

On Sep 9, 2008, at 4:38 PM, Nathan Rixham wrote:

Jason Pruim wrote:

Hey everyone,
Not completely specific to php but I know you guys know  
regex's  better then I do! :)
I am attempting to match purl.schreurprinting.com/jasonpruim112  
to purl.schreurprinting.com/p.php?purl=jasonpruim112

Here are my current matching patterns:
 RewriteRule /(.*) /volumes/raider/webserver/ 
documents/dev/schreurprinting.com/p.php?purl=$

#   RewriteRule /(*.) /purl.schreurprinting.com/$1
#   RewriteRule /(mail.php?purl=*) / 
purl.schreurprinting.com/mail.php?purl=$1
Yes I am doing this for apache's mod_rewrite, but my question  
is much more specific to regex's at this point :)
Any ideas where I am going wrong? it seems like it should be  
fairly simple to do, but I don't know regex's at all :)

--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]


RewriteRule ^jasonpruim112$ /p.php?purl=jasonpruim112 [L]

Just tried it, and it pops up with a 404... I'll keep looking.
One other thing that I should probably add is the fact that the  
^jasonpruim112$ could have hundreds of counterparts  
^bobsmith112$ ^jerrybob112$ etc... etc...

Thanks for looking though!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]

here's a typical rule; probably best to modify what works and go  
from there :)


RewriteRule ^directory/(.*)$ /newdirectory/$1 [L]

the other alternative is to let php handle it..
this is basicaly if request isn't a file or a directory route to a  
php handler [my prefered way]:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /notfound_handler.php [L]


RewriteRule . /notfound_handler.php [L,QSA]

the QSA tells apache to to automatically append any query string,  
saves
the hassle of having to deal with it in the regexp (assuming you  
might need it)


also beware that external redirects will cause POSTs to become GETs  
so that

the script/code in question never recieves the POST.


Interesting... that may explain a problem I am having with some other  
local links in that directory...





Interesting idea... I hadn't thought about that... Then I could  
just use a regex in php and grab everything after the domain name  
and pass it to my database to search and find the appropriate info  
to pull out...


your probably wanting the info in $_SERVER['REQUEST_URI'] ... which is
the complete uri before it was rewritten.


That's actually what I started using, then I just explode that to get  
my query string to use in the database lookup.





also check this func out, will probably spare you the regexp  
completely:


http://php.net/manual/en/function.parse-url.php


Ohhh... That sounds promising... I'll have to take a look at it later.




I'll have to do some searching :)


always ;-)


The problem with the internet is there is so much out there... Trying  
to weed the crap from the food can be a long digestive process which  
ends up with MORE crap coming out... This list... It's like pepto  
bismo for my programming :P



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Re: Regex help

2008-09-09 Thread Jochem Maas

Jason Pruim schreef:


On Sep 9, 2008, at 12:18 PM, Jochem Maas wrote:



...


I'll have to do some searching :)


always ;-)


The problem with the internet is there is so much out there... Trying to 
weed the crap from the food can be a long digestive process which ends 
up with MORE crap coming out... This list... It's like pepto bismo for 
my programming :P


and there is us trying so hard to give everyone stomach ulcers :-)
must  try  harder.




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]








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



Re: [PHP] Re: regex help and file question

2004-08-07 Thread PHP Gen

 Hi,
 
 I can't answer your regexp question but some
 thoughts on file() etc.:
 - file() returns the contents line by line as an
 array, so this makes only
 sense if you need the contents in this form, e.g.
 for looping through each
 line and applying a function or whatever
 - fread() requires a file handle that you have to
 create with fopen(), so
 file_get_contents() is kind of a shortcut for
 fopen()/fread()
 

Hey,

Thanks for replying and the answer to my second Q,
sounds like file_get_contents() is good for me now.

I think i found a solution for the regex too, just
have to modify some parts.

Cheers,
Mag

=
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




__
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 

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



Re: [PHP] Re: regex help needed -- Solved! Thanks!

2004-08-02 Thread Fabrice Lezoray
Kathleen Ballard a écrit :
Thanks!  Works like a charm!
I am the very lowest of newbies when it comes to regex
and working through your solutions has been very
educational.  I have one question about something I
couldn't figure out: 

#h[1-9](.*)/h[1-9]#Uie
`h([1-6]).*?/h\1)`sie
What is the purpose of the back-ticks and the '#'? 
PCRE patterns has to be enclosed, you can use all the non alpha numerics 
characters to do that. Personnaly, I prefer back ticks because I don't 
have to escape it often inside my patterns.
For my example, you can also remove the ``s pattern modifier, It makes 
the dot ( . ) accept any New line characters, and I had not see  that 
you removed them before.

What are 'Uie' and  'sie'?
there are patterns modifiers, you can find a complete list and 
descriptions here :
http://www.php.net/manual/en/pcre.pattern.modifiers.php


Thanks again!
Kathleen
-Original Message-
From: Fabrice Lezoray [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 01, 2004 2:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: regex help needed 

hi
M. Sokolewicz a écrit :
You could try something like:
$return = preg_replace('#h[1-9](.*)/h[1-9]#Uie',
'str_replace(br 

/, , $1)');
- Tul
Kathleen Ballard wrote:

Sorry,
Here is the code I am using to match the h* tags:
h([1-9]){1}.*/h([1-9]){1}
I think this mask is better :
`h([1-6]).*?/h\1)`sie

I have removed all the NL and CR chars from the
string
I am matching to make things easier.  Also, I have
run
tidy on the code so the tags are all uniform.
The above string seems to match the tag well now,
but
I still need to remove the br tags from the tag
contents (.*).
To remove the br / tags, you need to call
preg_replace_callback() :
?php
$str = 'h1hi br / ../h1 bla bla h5  br /
../h5 ...br /';
function cbk_br($match) {
	return 'h' . $match[1] . '' . str_replace('br /',
'', $match[2]) . 
'/h' . $match[1] . '';
}
$return =
preg_replace_callback('`h([1-6])(.*?)/h\1`si',
'cbk_br', 
$str);
echo $return;
?

The strings I will be matching are html formatted
text.  Sample h* tags with content are below:
h4Ex-Secretary Mickey Mouse br /Loses Mass.
Primary/h4
h4Ex-Secretary Mickey Mouse br /Loses Mass.
Primary br / Wins New Jersey/h4
h4Ex-Secretary Reich Loses Mass. Primary/h4
Again, any help is appreciated.
Kathleen


Sorry for my bad english ..
--
Fabrice Lezoray
http://classes.scriptsphp.fr
-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: regex help needed -- Solved! Thanks!

2004-08-01 Thread Kathleen Ballard

Thanks!  Works like a charm!

I am the very lowest of newbies when it comes to regex
and working through your solutions has been very
educational.  I have one question about something I
couldn't figure out: 

#h[1-9](.*)/h[1-9]#Uie
`h([1-6]).*?/h\1)`sie
What is the purpose of the back-ticks and the '#'? 
What are 'Uie' and  'sie'?

Thanks again!
Kathleen

-Original Message-
From: Fabrice Lezoray [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 01, 2004 2:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: regex help needed 

hi

M. Sokolewicz a écrit :
 You could try something like:
 $return = preg_replace('#h[1-9](.*)/h[1-9]#Uie',
'str_replace(br 
 /, , $1)');
 
 
 - Tul
 
 Kathleen Ballard wrote:
 
 Sorry,
 Here is the code I am using to match the h* tags:

 h([1-9]){1}.*/h([1-9]){1}
I think this mask is better :
`h([1-6]).*?/h\1)`sie



 I have removed all the NL and CR chars from the
string
 I am matching to make things easier.  Also, I have
run
 tidy on the code so the tags are all uniform.

 The above string seems to match the tag well now,
but
 I still need to remove the br tags from the tag
 contents (.*).
To remove the br / tags, you need to call
preg_replace_callback() :

?php
$str = 'h1hi br / ../h1 bla bla h5  br /
../h5 ...br /';
function cbk_br($match) {
return 'h' . $match[1] . '' . str_replace('br /',
'', $match[2]) . 
'/h' . $match[1] . '';
}
$return =
preg_replace_callback('`h([1-6])(.*?)/h\1`si',
'cbk_br', 
$str);
echo $return;
?


 The strings I will be matching are html formatted
 text.  Sample h* tags with content are below:

 h4Ex-Secretary Mickey Mouse br /Loses Mass.
 Primary/h4

 h4Ex-Secretary Mickey Mouse br /Loses Mass.
 Primary br / Wins New Jersey/h4

 h4Ex-Secretary Reich Loses Mass. Primary/h4

 Again, any help is appreciated.
 Kathleen


-- 
Fabrice Lezoray
http://classes.scriptsphp.fr

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



Re: [PHP] Re: Regex Help

2004-01-27 Thread karthikeyan.balasubramanian
Hi Ben,

  Your code works but If i remove the delimter [] which
I gave so that you could capture the data which needs to be
picked it doesnt work?.  Any help?

Karthikeyan B
- Original Message -
From: Ben Ramsey [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Karthikeyan
[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 11:56 PM
Subject: [PHP] Re: Regex Help


 Check the PHP manual for preg_match()
 (http://us3.php.net/manual/en/function.preg-match.php).

 I did play around with it a little bit, and I think I've got a starting
 point for you to work with.  Try out this code and then play around with
 it to get the results you need.  $matches[2][0] will hold the full line
 for Mayberry Mob.  You could then just use the substr() function to pull
 the data from that line.

 The code is, as follows:

 $subject = 
 =
 NF [1/21/04] E Race 11 Grade B [5-16] Going F

 U Too Tipsy  60½ 2 1 1 1   1 1   1 ½  30.46   4.40  Held Firm
Inside

 Dream Away   62  8 2 3 2   3 2 ½  30.51   17.90 Up For Plc
Mdtk

 Pounce N Bounce  70  5 4 2 1   2 3 2  30.58   4.50  Held Show
Inside

 Oneco Conor  67½ 7 8 4 5   4 4 2  30.60   6.90  Evenly Inside

 Krazy Kirk   70  4 3 6 7   5 5 5  30.79 * 1.90  Varied
 Little Mdtrk

 Mayberry Mob 73½ 1 6 5 6   6 6 10 31.15   5.30  Never
 Prominent Ins

 Jw Alley's Wish  60  3 7 8 9   7 7 10 31.17   6.50  No Factor
Mdtrk

 Rooftop Comet56  6 5 7 8   8 8 19 31.79   21.80 Never In It
Mdtk
 
 ;
 $pattern = /\[(\d+\/\d+\/\d+|\d+\-\d+)\]|(Mayberry Mob.*)/;
 if (preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER)) {
 print_r($matches);
 } else {
 echo no match.;
 }

 Hope that helps!



 Karthikeyan wrote:

  Sorry last time I forgot to put subject on my mail.  So here
  I am putting appropriate subject and sending it.
 
  Hi All,
 
Just wondering if somebody can help me with this small regex search.
  The information I wanted to capture is the one in the Square Bracket.
  i.e Date : 1/21/04, Race Type: 5-16, Dog Position: 6(Mayberry Mob)
 
  =
  NF [1/21/04] E Race 11 Grade B [5-16] Going F
 
  U Too Tipsy  60½ 2 1 1 1   1 1   1 ½  30.46   4.40  Held Firm
  Inside
 
  Dream Away   62  8 2 3 2   3 2 ½  30.51   17.90 Up For Plc
Mdtk
 
  Pounce N Bounce  70  5 4 2 1   2 3 2  30.58   4.50  Held Show
  Inside
 
  Oneco Conor  67½ 7 8 4 5   4 4 2  30.60   6.90  Evenly
Inside
 
  Krazy Kirk   70  4 3 6 7   5 5 5  30.79 * 1.90  Varied
  Little Mdtrk
 
  [Mayberry Mob] 73½ 1 6 5 6   6 6 10 31.15   5.30  Never
  Prominent Ins
 
  Jw Alley's Wish  60  3 7 8 9   7 7 10 31.17   6.50  No Factor
Mdtrk
 
  Rooftop Comet56  6 5 7 8   8 8 19 31.79   21.80 Never In It
  Mdtk
  
 
  Looking forward to hear some response.
 
  Have a great day.
 
  Karthikeyan B
 

 --
 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] Re: Regex Help

2004-01-27 Thread Ben Ramsey
Why do you need to remove the delimeters?  If you remove them, then it 
makes it quite difficult to get the data you need.  If you want to 
display the date and race type without the square brackets around them, 
then use $matches[0][1] and $matches[1][1] instead of $matches[0][0] or 
$matches[1][0].



Karthikeyan.Balasubramanian wrote:
Hi Ben,

  Your code works but If i remove the delimter [] which
I gave so that you could capture the data which needs to be
picked it doesnt work?.  Any help?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: RegEx -- help

2003-10-10 Thread Robert Cummings
On Fri, 2003-10-10 at 16:18, Curt Zirzow wrote:
 On Fri, 10 Oct 2003 14:01:00 -0400 (EDT), Lists [EMAIL PROTECTED] wrote:
 
  I do not know if this is the right list, but if someone could help me 
  with the following
 
 Sure, I'll be glad to help.
 
 
  I need a function that does this:
 
 I'm not sure if you want me to write the code that does this for you, but I 
 know that I wont. I'm just going to give you the tools that are commonly
 used for the tasks your asking for.
 
 
  function phone($num) {
 
  take num and remove anything that is not a number
  ex: () - /
 
 http://php.net/preg_replace
 
 
 
  If there is not 1 at the start, add a one to the start of the number.
 
 http://php.net/substr
 
 
  make sure that the number is 10 digits (if not return -1)
 
 http://php.net/strlen
 
  }
 
  Thank you for your help,
 
 In the future, please at least try and attempt to write the code, most 
 people here arnt here to write code for everyone, but to solve problems 
 people are
 having with their own code.

Incidentally the procedure for correcting the number is flawed. If you
(original poster) have a 9 digit number with an area code beginning with
a 1 then the required additional 1 will never be prepended. Really what
you want is if the sequence of numbers is 9 digits long then precede
with a 1.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Re: Regex Help with - ?

2003-06-27 Thread Gerard Samuel
sven wrote:

looks like id3v2 ;-)

how about this:
$string = [TIT2] ABC [TPE1] GHI [TALB] XYZ;
$pattern = /\[TIT2\]([^]*)/; // matches anything exept ''; till '' or
end of string
preg_match($pattern, $string, $match);
var_export($match);
Yeah, Im trying to figure out a way to parse these tags.

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