Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I split long regex into multiple lines? #8

Open
dausruddin opened this issue Oct 4, 2021 · 3 comments
Open

Can I split long regex into multiple lines? #8

dausruddin opened this issue Oct 4, 2021 · 3 comments

Comments

@dausruddin
Copy link

Since there is a lot to type for each replacement, I am combining many regex into one. But this resulting in a very long line. Can I somehow split a regex into multiple lines in this module? Something like:

filter {
    search_pattern "(todelete1\
|todelete2\
|todelete3)"
    replacement ""
    content_type html
}

Thank you.

@skyzh
Copy link
Member

skyzh commented Oct 4, 2021

I don't think caddy's config parser would support it. cc @htfy96 could you please take a look?

@htfy96
Copy link
Contributor

htfy96 commented Oct 12, 2021

Sorry for the late response. I'll take a look into this after work today

@htfy96
Copy link
Contributor

htfy96 commented Oct 15, 2021

I think Caddy by default already supports escaping line end with \:

config

{
    debug
    auto_https off
    order filter after encode
}
http://localhost:2015 {
    filter {
        content_type .*
        search_pattern "aaa\
|bbb\
|ccc"
        replacement "replaced"
    }

    respond "ccc"
}
$ curl http://localhost:2015
replaced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants