Hello. I have a string that im trying to pull text from. But I want it to pull the text between certain points. Is this possible?

For Example:

DABHolly,BuddyDAL1466 N Scooby AveDAIAtlantaDACGADAQ

=========================== =========

Is there a script that can pull the text between DAB & DAL, DAL & DAI, DAI & DAC, etc.

Im trying to extract "Holly, Buddy", "1466 N Scooby Ave", "Atlanta", and "GA"

You can use regular expressions. Every language I know of either has an implementation of it, or can use a library to do it.

Or you could try something like this:

$source = "DABHolly,BuddyDAL1466 N Scooby AveDAIAtlantaDACGADAQ";

$name_start	= strpos($source,"DAB")+3;
$name_end 	= strpos($source,"DAL");
$name 		= substr($source,$name_start,$name_end - $name_start);

$addr_start	= strpos($source,"DAL")+3;
$addr_end 	= strpos($source,"DAI");
$addr 		= substr($source,$addr_start,$addr_end - $addr_start);

$city_start	= strpos($source,"DAI")+3;
$city_end 	= strpos($source,"DAC");
$city 		= substr($source,$city_start,$city_end - $city_start);

$state_start	= strpos($source,"DAC")+3;
$state_end 	= strpos($source,"DAQ");
$state 		= substr($source,$state_start,$state_end - $state_start);

echo "<p>Name: $name</p>";
echo "<p>Addr: $addr</p>";
echo "<p>City: $city</p>";
echo "<p>State: $state</p>";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.