-4

I've a txt file, structured like that:

*ABC123 a ABC123 ,
    / comment here
    DEF452 hju
then ABC123 h
   DEF452 hh,
   6HH , 7JJ , 8LL,
   Z123 enf of file
\ \

*ABC124 a ABC124 ,
    / comment here
    DEF4552 hju
then ABC124 h
   DEF4566 hh,
   62HH , 78JJ , 128LL,
   Z124 enf of file
\ \

What i need is to extract some pieces of this block of "code", that is variable in lenght and with different values each time.

Any tip?

Luke
  • 503
  • 2
  • 7
  • 17
  • 3
    Start by trying to extract it. Try *something*. – Blender Mar 11 '13 at 10:27
  • ie: i need all the variables after "then" , from the first value to the end (the end of each block is delimited by " end of file \ \ " – Luke Mar 11 '13 at 10:36

1 Answers1

0
preg_match_all('/[a-z]+:\/\/\S+/', $string, $matches);

This is an easy way that'd work for a lot of cases, not all. All the matches are put in $matches.

Here is a link on using regular expressions in PHP: http://www.regular-expressions.info/php.html. Also, here is a link for email regular expressions: http://www.regular-expressions.info/email.html

Good luck.

punit
  • 182
  • 1
  • 5