acloudtree

Tag preg_match

Agapage : lastName regex

So I met with the Children’s minister at my church and she reported a bug with Agapage. It was a pretty simple fix. Basically her last name was something I didn’t account for, you see it consists of two words.

Example : ‘Van Hoorst’

And the filter that I had originally created was only searching for one continuous string.

Here is the regular expression before

preg_match('/[a-zA-Z\']+/',$this->last_name,$matches);

and here is what I ended up with after

preg_match('/[a-zA-Z\']+\s{0,1}[a-zA-Z\']*/',$this->last_name,$matches);

I also trimmed any trailing spaces afterward just to clean things up.

-later
jared

Copyright © Jared Folkins
Programming, Computers, Writing, Economics, and Life

Powered by WordPress