News:

Wondering if this will always be free?  See why free is better.

Main Menu

Custom Field and Regex

Started by TLM, April 19, 2008, 11:33:29 AM

Previous topic - Next topic

TLM

Is this a complete feature or am I just doing something wrong with regex or expecting it to do something it does not do?

I set the field to regex, so I could filter wii friend codes for my community, with
([0-9]{4})\ ([0-9]{4})\ ([0-9]{4})\ ([0-9]{4})

I put data in my profile on the forum with both of these data sets,

1111 2222 3333 4444
1111 2222 3333 DDDD

They both passed, did not kick an error, bug?

Should it kick back an error if the entry does not match the regex?

Oldiesmann

It should just set it to an empty string if it doesn't match...

Sources/Profile-Modify.php
Code (Lines 1237-1238) Select
elseif (substr($row['mask'], 0, 5) == 'regex' && preg_match(substr($row['mask'], 5), $value) === 0)
$value = '';
Michael Eshom
Christian Metal Fans

TLM

Did I screw up in the regex statment then? 4 groups of 4 numbers is what it should be.

karlbenson

I believe your missing a pattern delimiter
eg
@([0-9]{4})\ ([0-9]{4})\ ([0-9]{4})\ ([0-9]{4})@

I used @ but some people use # or ~ or other characters as pattern delimiter.

TLM


Advertisement: