How to use the filter?

How to use the filter, before WordPress converts !--nextpage--?

The following construction does not work:

add_filter ( "the_content", function( $content ) {

  $content = preg_replace( "/(\\!--nextpage--\)/miu", htmlspecialchars( $1, ENT_QUOTES, 'UTF-8', false ), $content );

  return $content;

});

Code just for example.

Topic nextpage Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.