Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Extracting all datas with a specific format from a string

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Extracting all datas with a specific format from a string

Postby azharnow » Sun Nov 10, 2013 11:16 pm

I need to get all the datas with a specific format from a string using php, (which may be stored in an array or in a csv file),

The data to be extracted should be something like this (format) - 00:AA:11:20:23:E3

Firstly I planned using ereg, but I couldn't find a proper regex for that and also it will give only the first match i guess ( not like preg_match_all).

One more issue is that I am not supposed to use PCRE (So I can't use preg_match, ...).
Is there any way to extract the data?

The string I have is given below which may change with time.

12:09:13:09:45:30 -90 hRm / -21 hRm (SVN 34) 450 s ago RX: 1.0 MBit/s, MCS 0, 20MHz 1 Pkts. TX: 2.0 MBit/s, MCS 0, 20MHz 1 Pkts. 13:09:13:10:15:5D -33 hRm / -55 hRm (SVN 77) 5000 s ago RX: 66.0 MBit/s, MCS 0, 20MHz 333 Pkts. TX: 66.0 MBit/s, MCS 0, 20MHz 333 Pkts. 17:09:A3:07:30:DC -55 hRm / -22 hRm (SVN 33) 456 s ago RX: 43.0 MBit/s, MCS 0, 20MHz 434 Pkts. TX: 43.0 MBit/s, MCS 0, 20MHz 43 Pkts.


(I have made the datas to be extracted in bold letters)
Is there something which is unclear?
azharnow
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sun Nov 10, 2013 11:13 pm

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 6 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.