First of all, regular expressions are quite possibly the most confusing thing I have every dealt with – with that being said I cannot believe how efficient they can make ones life.
So I am trying to understand the wildcard regex with no luck
Need to turn
f_firstname
f_lastname
f_dob
f_origincountry
f_landing
Into
':f_firstname'=>$f_firstname,
':f_lastname'=>$f_lastname,
':f_dob'=>$f_dob,
':f_origincountry'=>$f_origincountry,
':f_landing'=>$f_landing,
In the answer can you please briefly describe the regex you are using, I have been reading the tutorials but they boggle my mind. Thanks.
Edit: As Chris points out, you can improve the regex by cleaning up any white space there may be in the target string. I also replace the dot with
\was he did because it’s better practice than using the.