What happened to my regex?

I need to remove any character that is not from 0 to 9, from a to z, but from A to Z.

heres my code:

$alt = preg_replace('/[^0-9a-fA-F]/', '', $_POST['alt-text']);

right now if i type β€œalt text” it will turn it into β€œae”

+3
source share
1 answer

You have af instead of az, the same for AZ.

+3
source

Source: https://habr.com/ru/post/1784318/


All Articles