![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | How to make regex case insensitive I have the following code in a script I'm writing. The problem I'm having is it that it's not picking up text which doesn't match the case used in the regex e.g. 'ERROR' is not being matched whereas 'error' is. $Pattern = [regex]"error|warning|fault" $Match = $Pattern.Match($someText) while ($Match.Success) { $someText = $someText.replace($Match.Groups[0].Value, "") $Match = $Match.NextMatch() } The question is how do I modify the above code to make the regex ignorecase? Is there a flat I can set somewhere? Thanks |
| | #4 (permalink) | ||||||||||||
| Guest | Re: How to make regex case insensitive <stephenodonoghue@xxxxxx> wrote in message news:1194467647.744092.192220@xxxxxx
[regex]::Replace($someText, "(?i)error|warning|fault", "") -- Keith | ||||||||||||
| | #7 (permalink) | ||||||||||||||||||||||||
| Guest | Re: How to make regex case insensitive Keith Hill [MVP] wrote:
| ||||||||||||||||||||||||
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Regex | IT Staff | PowerShell | 3 | 1 Week Ago 07:33 AM |
| regex help | tonyr | PowerShell | 4 | 07-02-2008 02:13 PM |
| Regex Help | dm_14 | PowerShell | 7 | 06-11-2008 08:33 PM |
| Regex Help | Christopher Robin | .NET General | 1 | 03-31-2008 02:02 PM |
| regex | IT Staff | PowerShell | 4 | 01-02-2008 02:07 AM |