Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Multiline regex not working #163

Open
galeksandrp opened this issue Aug 25, 2018 · 3 comments
Open

Multiline regex not working #163

galeksandrp opened this issue Aug 25, 2018 · 3 comments

Comments

@galeksandrp
Copy link
Contributor

galeksandrp commented Aug 25, 2018

$fileContent = gc $fileName -Encoding UTF8

Is it safe to use -Raw?

$fileContent = gc $fileName -Encoding UTF8 -Raw
@majkinetor
Copy link
Owner

No its not safe. All current regexes would stop working like expected.

BUT, I could probably make it parametrized in this way:

function global:au_SearchReplace {
    @{ 
           search1 = replace1
           options = "Raw"
       }
}

@majkinetor
Copy link
Owner

The current behavior is documented:

NOTE: The search and replace works on lines, multiple lines can not be matched with single regular expression.

@majkinetor
Copy link
Owner

FYI, you can make it work now like this: do multine line search and replace inside au_BeforeUpdate.

kai2nenobu added a commit to kai2nenobu/chocolatey-packages that referenced this issue Aug 13, 2022
Replacements in an au_SearchReplace function is applied to each single lines.
Font names in README is multiline, therefore we replace README in an
au_BeforeUpdate() function.

ref. majkinetor/au#163
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants