You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
I can find text using a Regex (Paragraph.FindAllByPattern function) but
cannot replace text with a Regex (Paragraph.ReplaceText function). Am I missing something?
This matches the text: $WordDocument.Paragraphs[2].FindAllByPattern('E.*?e',[System.Text.RegularExpressions.RegexOptions]::None)
This uses the same pattern but does not do the replacement: $WordDocument.Paragraphs[2].ReplaceText('E.*?e','Awesomeness', $false, [System.Text.RegularExpressions.RegexOptions]::None)
The text was updated successfully, but these errors were encountered:
Could it be related to formatting? In theory DocX fixed that in version 1.4.1 (https://github.com/xceedsoftware/DocX/wiki/Release-Notes-v1.4.1) which we use but maybe it requires an additional option? You could try replacing DLL with the new version and seeing if it fixes your issue - the problem is - there were a lot of changes that may break different functionality. Normally I would go and update PSWriteWord to the newest DLL but the license change they did is risky for us and I am struggling whether to make a change or not. I would suggest to maybe use power of PowerShell and just go thru Paragraph yourself, get all the content and do regex in PowerShell rather then pass it to DocX?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I can find text using a Regex (Paragraph.FindAllByPattern function) but
cannot replace text with a Regex (Paragraph.ReplaceText function). Am I missing something?
This matches the text:
$WordDocument.Paragraphs[2].FindAllByPattern('E.*?e',[System.Text.RegularExpressions.RegexOptions]::None)
This uses the same pattern but does not do the replacement:
$WordDocument.Paragraphs[2].ReplaceText('E.*?e','Awesomeness', $false, [System.Text.RegularExpressions.RegexOptions]::None)
The text was updated successfully, but these errors were encountered: