I am using credit card swipe reader to get the credit card info on Web page. I am successful to get the info of credit card on Web page. But it is a long string and I get it in 1 field. I know I have to split it but I don't know how.
I would recommend attempting to reformat the swipe data to be inline with most magstripe readers. Typically the track 1 begin is "%B" and end is "?", the track 2 is ";" and "?".
Also, what data are you specifically attempting to get outside of the Name, Card Number and Exp? Those are typically all in track 1 for you.
Card #: 4888940130123456
Name: ^DOE/JOHN L^
How about simple regex?
output = card_data.split(/\^/);
That way you get
if you want the last one split too you can do once again
numbers = output.split(/\=/);
which will give you