greenba Posted February 12, 2008 Share Posted February 12, 2008 Hi, I have the following in a string: 1�1268� ��� ������� ������������������� ��� ��� �������2008�10106�263094410008�1G�1�IM�4��������1�1�263094410008����430.00��CH����110-E-963/110-E-694�BA�0�FCA�VELIKA��110-E-963/110-E-694�BA�CHF�9500.00�1�1�30��BAVKL��10104���������������0.00��0.00�4305.54�4�����0�9500.00�CHF�1.223540�1.00000�11623.63�350.00�BAM�1.000000�1.00000�350.00�1.00�BAM�1.000000�1.00000�1.00�80.00�BAM�1.000000�1.00000�80.00����1.00000�0.00�1.00�BAM�1.000000�1.00000�1.00�430.00�12053.63�� Now what I need is to have some variables taken out, so $var1 = "110-E-963/110-E-694" and $var2 = "9500.00". I cannot use the exact character location, as it can change, the only thing that is always the same is number of � Any ideas, all are welcome Thanx Adnan Link to comment https://forums.phpfreaks.com/topic/90749-reading-btw-strings/ Share on other sites More sharing options...
chronister Posted February 12, 2008 Share Posted February 12, 2008 Is anyone else seeing the letters properly or are you seeing the Unicode Replacement Glyph (diamond with white question mark) All I see are the Unicode Replacement Glyph marks Link to comment https://forums.phpfreaks.com/topic/90749-reading-btw-strings/#findComment-465198 Share on other sites More sharing options...
Caesar Posted February 12, 2008 Share Posted February 12, 2008 Is anyone else seeing the letters properly or are you seeing the Unicode Replacement Glyph (diamond with white question mark) All I see are the Unicode Replacement Glyph marks Same. Link to comment https://forums.phpfreaks.com/topic/90749-reading-btw-strings/#findComment-465199 Share on other sites More sharing options...
greenba Posted February 12, 2008 Author Share Posted February 12, 2008 Yea they are � symbols, they are found in the string, they are always there and we can use them as guides as where the text is that I want to extract to a $var1 Link to comment https://forums.phpfreaks.com/topic/90749-reading-btw-strings/#findComment-465204 Share on other sites More sharing options...
Caesar Posted February 12, 2008 Share Posted February 12, 2008 <?php preg_match('/[0-9]+\-[A-Z]\-[0-9]+\/[0-9]+\-[A-Z]\-[0-9]+/', $str, $v1); preg_match('/\?BA\?CHF\?([0-9]+\.[0-9]+)\?/', $str, $v2); $var1 = $v1[0]; $var2 = $v2[1]; ?> But who knows how reliable that will be....considering you said the string changes. Link to comment https://forums.phpfreaks.com/topic/90749-reading-btw-strings/#findComment-465348 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.