Parse through text and find text

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Parse through text and find text

Post by JKM »

I want to search through the text and find the following:
- Text inside double quotes where the line contains 'conID_<number(1,30)>'
Output:
echo '<strong>'.$quotes.':</strong> '.$conID.'.';

Edit: There can be multiple lines with different data inside the quotes and different conID. Example of input:
basd asgfdg bla bla bla asdfdsfsdf sd
fdgsfd gdfgssdfg "123 4567 89" fdg conID_3565765 dsfsdfs dsfsd sdf sdf s
gfsdg hgfhdf asf bla bla
fdgsfd gdfgssdfg "123 456790" fdg conID_3554355 dsfsdfs dsfsd sdf sdf s
fdgsfd gdfgssdfg "123 456 hey" fdg conID_35654665 dsfsdfs dsfsd sdf sdf s
In this case, the output should be like:
<strong>123 4567 89:</strong> conID_3565765
<strong>123 456790:</strong> conID_3554355
<strong>123 456 hey:</strong> conID_35654665
Post Reply