Jump to content

sh44n

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sh44n's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. sample code: ------------ "ASSET","ASSET ACCOUNT","1","1995-08-19 12:20:29","insagptp","",,"1995-08-19 12:20:29","insagptp" "LIAB","LIABILITY ACCOUNT","1","1995-08-19 12:20:30","insagptp","",,"1995-08-19 12:20:30","insagptp" "IS","INCOME ACCOUNT","1","1995-08-19 12:20:31","insagptp","",,"1995-08-19 12:20:31","insagptp" "CASHFLOW","CASH FLOW ACCOUNT","1","1995-08-19 12:20:31","insagptp","",,"1995-08-19 12:20:31","insagptp" "SUPPL","SUPPLEMENTARY ITEM","1","1995-08-19 12:20:32","insagptp","",,"1995-08-19 12:20:32","insagptp" "INDSTAT","INDUSTRY STATISTIC","1","1995-08-19 12:20:33","insagptp","",,"1995-08-19 12:20:33","insagptp" How would I get the data in the array without the double quotes in each column data? T
  2. Thanks Orio again. It works perfectly. Thumbs up.!
  3. Sample Data -------------- "Costs of Goods & Services / Total Expenses","-88,105","-91,960","-46,339","-47,400","-48,692","-52,892","-41,672","-43,334","-46,671","-43,203" This is a CSV data including comma-separated numerics. The problem is when i try to split it with the following code, it also splits it on the basis of decimals, $arr_tag_pieces = explode(',',$value); I tried a trick by splitting it as follows i.e. splitting on the basis of [","] $arr_tag_pieces = explode('","',$value); but the problem is that the first element and last element of the array receives the double quotes in the beginning and the end respectively. $arr_tag_pieces[0] = "Costs of Goods & Services / Total Expenses $arr_tag_pieces[10] = -43,203" any suggestions/way-outs?
  4. Thank you all for taking time out to help. Your effort in this regard is highly appreciated. Orio, the examples works perfect but it seems to get the last index when we have data like this line1 line2 line3 <borad of directors> board1name board2name board3name <address at place> address 1 address 2 address 3 .... it seems to get in the array $result['directors'] = its respective data NOT result['board of directors'] $result['place'] = its respective data NOT result['address at place'] though fortunately, the sample data i'm working still gives a unique data to the index but still as a student currently of regex I would like to learn that how to proceed. A little explanation of the regex difference in that regard will be highly appreciated as well. Thanks in anticipation again.
  5. also is it possible that the $result array can contain the data as follows: $result['tag1'] = its respective data $result['tag2'] = its respective data $result['tag3'] = its respective data
  6. Thank you very much Orio. It works perfectly but how can I keep the <tag1> content generic without hardcoding it in regex ? Like Line1 Line2 Line3 Line4 <directors> Tag1 Line1 Tag1 Line2 Tag1 Line3 Tag1 Line4 <address> Tag2 Line1 Tag2 Line2 Tag2 Line3 Tag2 Line4 <copyright> . . . also is it possible that the $result array can contain the data as follows: $result['tag1'] = its respective data $result['tag2'] = its respective data $result['tag3'] = its respective data
  7. The data file is like that Line1 Line2 Line3 Line4 <tag1> Tag1 Line1 Tag1 Line2 Tag1 Line3 Tag1 Line4 <tag2> Tag2 Line1 Tag2 Line2 Tag2 Line3 Tag2 Line4 <tag3> . . . how to regex to get the first 4 lines before the tag1 and then grabbing data between <tag1> and <tag2> and associating it with index tag1 and so on. In short data for tag1 data = betwen <tag1> and <tag2> tag2 data = betwen <tag2> and <tag3> . . . so on. Looking forward for your help guys.
×
×
  • 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.