Gugel Posted August 14, 2008 Share Posted August 14, 2008 Hi there, Noob here. Any PHP gurus here that can come to my rescue? I'm sure this is fairly straightforward, but I just can't seem to figure it out! Any help would be greatly appreciated! OK, here's a sample of the data that's gonna be entered on a form. There's lot of junk we don't need, but we have 4 entries separated by a line break. I've bolded what we DO need. 00001740 29 v 04 breathe 0 take_a_breath 0 respire 0 suspire 3 021 * 00005041 v 0000 * 00004227 v 0000 + 03189605 a 0301 + 00819106 n 0303 + 04034949 n 0301 + 04200499 n 0105 + 00819106 n 0101 ^ 00004227 v 0103 ^ 00005041 v 0103 $ 00002325 v 0000 $ 00002573 v 0000 ~ 00002573 v 0000 ~ 00002724 v 0000 ~ 00002942 v 0000 ~ 00003826 v 0000 ~ 00004032 v 0000 ~ 00004227 v 0000 ~ 00005041 v 0000 ~ 00006735 v 0000 ~ 00007366 v 0000 ~ 00017051 v 0000 02 + 02 00 + 08 00 | draw air into, and expel out of the lungs; "I can breathe better when the air is clean"; "The patient is respiring" 00002325 29 v 01 respire 1 005 $ 00001740 v 0000 @ 02088655 v 0000 + 03189605 a 0101 + 00819106 n 0103 + 00818726 n 0101 01 + 02 00 | undergo the biomedical and metabolic processes of respiration by taking up oxygen and producing carbon monoxide 00002724 29 v 01 choke 0 002 @ 00001740 v 0000 + 13871855 n 0101 01 + 02 00 | breathe with great difficulty, as when experiencing a strong emotion 00003133 29 v 01 hyperventilate 1 003 $ 00002942 v 0000 @ 00077958 v 0000 + 00821785 n 0101 01 + 09 00 | produce hyperventilation in; "The nurses had to hyperventilate the patient" Here's the output we're looking for: v, breathe, draw air into, and expel out of the lungs v, respire, undergo the biomedical and metabolic processes of respiration by taking up oxygen and producing carbon monoxide v, choke, breathe with great difficulty, as when experiencing a strong emotion v, hyperventilate, produce hyperventilation in Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/119691-extracting-data-from-a-string/ Share on other sites More sharing options...
Gugel Posted August 14, 2008 Author Share Posted August 14, 2008 Here's what I have so far...I broke it down into an array separated by line breaks: <?php $rawdata = $_GET['rawdata']; $linebyline = explode("\n", $rawdata); ?> Kinda lost from here on out... Link to comment https://forums.phpfreaks.com/topic/119691-extracting-data-from-a-string/#findComment-616640 Share on other sites More sharing options...
Gugel Posted August 15, 2008 Author Share Posted August 15, 2008 No one? Link to comment https://forums.phpfreaks.com/topic/119691-extracting-data-from-a-string/#findComment-617012 Share on other sites More sharing options...
compguru910 Posted August 15, 2008 Share Posted August 15, 2008 There is a way that if you could put some kind of braces around the words you wanted to use, then you could extract it with a string function. I do not know off hand what it is, but if you look up PHP string in google, it will take to you the PHP guide, and they will have soemthing on it there. Link to comment https://forums.phpfreaks.com/topic/119691-extracting-data-from-a-string/#findComment-617017 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.