Viper Viper - 9 months ago 65
PHP Question

Regex PHP - Starts with and ends with

I've following problem: I'm trying to replace every occurrence of a string that starts with % and also ends % with, in the middle of the precentage symbols there should be alphanumerical chars. and brackets () allowed.
This is what I currently have:



^%[a-zA-Z0-9()]+%$ would work fine if your percent signs start and end the line. However, I assume this is not the case.

^ means the beginning of a line, $ means the end of a line. I assume you would want just: %[a-zA-Z0-9()]+%