<?php $regex = '#[\-\d]$#'; $regex2 = '#[\\-\d]$#'; $regex3 = '#[\\\-\d]$#'; $value = '12-4'; preg_match($regex, $value, $matches); var_dump($matches); preg_match($regex2, $value, $matches); var_dump($matches); preg_match($regex3, $value, $matches); var_dump($matches);
You have javascript disabled. You will not be able to edit any code.