actually working on ubuntu, with PhpStorm, I'm trying (slowly but surely) to use regex to extract text from a .txt file.
For example, i'm looking to get a GSM number with this regex :
$pattern_numGSM = '#(GSM : (.{10}))#i';
To test it, I use this piece of code :
$subject = $fichier_noExt.'.txt';
preg_match($pattern_numGSM, $subject, $matches);
var_dump($matches[0]);
var_dump($matches[1]);
var_dump($matches[2]);
Having $fichier_noExt my txt file, which I can't share with you due to rights agreements... (It a bill for a phone buy, containing informations that i need to extract, like : bill_example)
Doing this, i get on my localhost the values : null null null
I checked the veracity of my regex on the web, it works fine but asa I test it back on phpstorm, null is all I got...
I've been stuck on it for half a day, so if your fresh eyes see anything that I miss, would be nice :).
Thanks in advance,
Regards,
Stelio Kontos.
EDIT : Problem solved, I was preg_matching my file, and not the content of my file... Yep, feeling so smart right now :d. Thanks Patrick !