如果在drupal视图中匹配则删除单词

I am using drupal 7. I want to remove word if this word is match from value. For example -

In my view i have 1 field

path: "/category/book/bookname"

Now i need to replace

path: "/book/bookname"

i am trying to solve it using drupal views regex rewrite . but it is not working, anybody can help me please? waiting for response.

Thanx

You can try this pattern that is PHP regex compatible:

Patterns

/^\/[^/]+\/book\/bookname$/

Replacements

/book/bookname

This regex pattern will match /<any_text_that_is_not_forward_slash>/book/bookname and replace with /book/bookname. Check if you need to escape the slash in the square brackets.