Skip to content

Option to disable regex in replace filter #13642

Closed Answered by brandonkelly
ghost asked this question in Ideas
Discussion options

You must be logged in to vote

Sorry, that was an unintended change in behavior.

I’ve just added a new regex argument to the |replace filter for the next release, which you can set to false to explicitly disable regex parsing:

{% set url = 'https://example.com/a/' %}

{% set urlWithoutPath = url|replace({'/a/': ''}, regex=false) %}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ghost
Comment options

@brandonkelly
Comment options

Answer selected by brandonkelly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
1 participant