Jump to content

search integer, stop at white space and store in variable.


homer.favenir

Recommended Posts

hi to all

i need help for my script please.

 

the case is like this

2HS             REFUGE PREGNANCY & RESOURCE CENTER                                         REFUGE PREGNANCY RESOURCE CENTER                  1307 MILSTEAD AV N*E                                   CNYRS                      30012770 922-5939V2
1HS             SOURCE PREGNANCY CARE CENTER                                                                                                 10258 FLAT SHOALS RD                                   COVINGTON                  30014770 786-1531V2

 

what i like to do is from the column of strt # which is column 142, the script will search for an integer and will stop if it sees a white space and will store that integer to a variable, and what follows the white space is the strt name, and it will store it in a variable also, after the strt name the searching will stop if it sees a tab.

objective is to separate the strt # and strt name from address column.

the addresses are:

1307 MILSTEAD AV N*E
10258 FLAT SHOALS RD

 

anyone please

thanks

I worked on somethink like that this way mate.........

 

$res1 anythink with numbers...

 

$res2 anythink with charecters

 

<?php
$a=array("12343323","asdfjferje","444443432434","53453453455");

foreach($a as $contents){

if(preg_match("/[0-9]/",$contents)){

	$contents1[]=$contents;

}else{
	$contents2[]=$contents;
}
}

foreach($contents1 as $res1){

	echo " This holds all the numbers in varable \$res1 $res1 <br> ";
}

foreach($contents2 as $res2){

	echo " This holds all the charecters in varable \$res2 $res2 <br> ";
}

 ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.