I am using PHP and I am trying to remove all underscore characters from the end and beginning of a string.
Here's the string: ____a_b_c__________
And I want the result to be: a_b_c
I have tried with this regular expression but it's not working:
preg_replace('/[^a-z]+\Z/i', '', '____a_b_c__________');