G
G
Gennady2020-08-18 11:12:26
PHP
Gennady, 2020-08-18 11:12:26

How to add slash in regular expression?

wp-kama describes how to remove /page/1 from the first pagination link:

preg_replace( '~/page/1/?([\'"])~', '\1', $paginate_links );


Everything would be fine, but urls are obtained without a slash at the end: https://site.ru/catalog . It turns out an extra redirect. You need to add a slash to $replacement . How would you do it? '\1/'does not work.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
dodo512, 2020-08-18
@theblackpost

preg_replace( '~/page/1/?([\'"])~', '/\1', $paginate_links );

V
Vladislav, 2020-08-18
@cr1gger

\\

R
Roman, 2015-05-04
@Martyer

google for
free psd templates for website
freebie psd for website
free psd for html
UPD. By the way, here is a nice site with various layouts and free psds - blazrobar.com

F
Fun_Color, 2015-05-05
@Fun_Color

https://dribbble.com/search?q=freebies
www.freebiesgallery.com/web-templates
psd-stock.ru/shablony-dlja-sajtov
Dare) I remember earlier the topic was on css-live css-live.ru/ category/practice

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question