Script regular expression searches

One search option for code in the WinStudio script editor is to do a [Regular Expression] search. This option uses regular expressions to locate the search text and uses replacement pattern syntax for regular expressions. This allows for replacements at different matched capture points in the search pattern.

[Regular Expression] find-and-replace operations search for text by using syntax pattern matching for .NET regular expressions. The operation ignores pattern whitespace. Whitespace can be matched by using the [\s] character class.

The [Regular Expression] search option has a feature that the others do not have: In its [Replace with] patterns, you can specify substitutions. [Replace with] patterns recognize normal text characters, regular expression escape characters ([\n] meaning line feed, etc.), and substitution specifications ($1, etc.).

Substitutions place text from captures into the replacement text. For example, suppose that the text to search in is using [System;], the [Find what] text is using [\s+ (\w[\w\.]+);], and the [Replace with] text is [Namespace: $1;]. This operation looks for any C# using statement and outputs the namespace. The result in this scenario is [Namespace: System;].

関連トピック