I'm having a small technical difficulty with a regular expression, I'm trying to look at a string, let's say we have this string:
$string = "error->400";
And another string:
$string = "error->debug->warning";
As an example, I'm basically trying to do a preg_match()
that returns true on any instances of ->
within it.
This is my attempt but I don't understand why it doesn't work:
preg_match("/^[->]*$/", $string);
Is there a general rule for custom characters that i'm generally missing?
Thanks.