I am trying to learn regex and came across this question: Extract a substring between two characters in a string PHP for which one of the answers has:
$input = "[modid=256]";
preg_match('~=(.*?)]~', $input, $output);
echo $output[1]; // 256
I am guessing ~=(.*?)]~
can be broken down into saying 'find the thing between =
and ]
' but what do the ~
mean and how are they used in general? (I have looked in other places but can't seem to find a meaning for this symbol)