Ryan A <mailto:[EMAIL PROTECTED]>
    on Monday, March 15, 2004 9:07 AM said:

> I know this is pretty easy to do but I am horrorable at working with
> regular expressions and was wondering if anybody might take a min to
> help please.

in that case you should get the regex coach (easy to find via google).
it's great!

> I will have a variable:   $the_extention
> which will have a value like:    98797-234234--2c-something-2c
> 
> How do I take out the part which will always start with  "--2c" and
> will always end with "-2c"

by using () around the part you want to grab.

<?php

  $string = "98797-234234--2c-something-2c";

  $pattern = "/\d{5}-\d{6}--2c-(.*)-2c/";

  preg_match($pattern, $string, $matches);

  print_r($matches);

?>

> A good "baby steps" tutorial on regex too would be appreciated.

there's lots of those. google can help you find them. try "regular
expression tutorial" or some variant of that.


hth,
chris.

p.s. i think you want extension not extention. :)

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

Reply via email to