P
P
paacha2016-03-11 08:30:52
PHP
paacha, 2016-03-11 08:30:52

How to compose a PHP regular expression so that the preg_replace function only handles exact matches?

It is necessary that the function

function no_link_current_page( $p ) {
  return preg_replace( '%((current_page_item|current-cat)[^< ]+)[^>]+>([^< ]+)%', '$1$3', $p );
}

processed only EXACT matches of the string "current-cat", now <li>actions are also taking place on the class "current-cat-parent". I would like to avoid this

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question