apetitjean / EZLog

A very easy and pragmatic log module for admins in a hurry.
48 stars 12 forks source link

Error formatting a string when passing regular expression to Write-EZLog #17

Closed davetustin closed 6 months ago

davetustin commented 6 months ago

When I pass my regular expression to Write-EZLog I get the following error.

Write-EZLog: Error formatting a string: Index (zero based) must be greater than or equal to zero and less than the size of the argument list..

The regular expression I am using is M(?<!\d)\d{9}(?!\d).

My hunch is it thinks the {9} is a placeholder.

I have yet to find a way around this, but still investigating. If you have any ideas, that would be fantastic.

davetustin commented 6 months ago

In the end I escaped the curly brackets using -replace "{", "{{" -replace "}", "}}"

That seems to fix it.