Change site style→

style-1 style-2
  1. nazenani
  2. >
  3. >
  4. >
  5. >
  6. URL processing by regular expression.

URL processing by regular expression.

The step of URL processing by regular expression is…

  1. 1: Get URL.
  2. 2: Replace unnecessary letters to blank.
  3. 3: Rplace a pattern of letters to blank.
  4. 4: Then Extracted slug from URL.

In step3, regular expression was used.
Here is the script.

preg_replace
Searches subject for matches to pattern(rex) and replaces them with replacement.
preg_replace($pattern, $replacement, $string);

In this case, pattern is ‘/\/[0-9]\/$/’, replacement is ”(blank), string is $url.

comment

Fields with * is required.

go to related tags archive?