💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# E.11 ReplaceRegexp The `ReplaceRegexp` filter will perform a regexp find/replace on the input stream. For example, if you want to replace ANT with Phing (ignoring case) and you want to replace references to \*.java with \*.php: ``` <filterchain> <replaceregexp> <regexp pattern="ANT" replace="Phing" ignoreCase="true"/> <regexp pattern="(\w+)\.java" replace="\1.php"/> </replaceregexp> </filterchain> ``` Or, replace all Windows line-endings with Unix line-endings: ``` <filterchain> <replaceregexp> <regexp pattern="\r(\n)" replace="\1"/> </replaceregexp> </filterchain> ``` E.11.1 Nested tags The `ReplaceRegExp` filter must contain one or more `regexp` tags. These must have `pattern` and `replace` attributes. The full list of supported attributes is as following: Table E.11:聽 Attributes for the `<regexp>` tag NameTypeDescriptionDefaultRequired`pattern``String`Regular expression used as needle. Phing relies on [Perl-compatible](http://php.net/pcre) regular expressions. n/aYes`replace``String`Replacement string.n/aYes`ignoreCase``Boolean`Whether search is case-insensitive.`false`No`multiline``Boolean`Whether regular expression is applied in multi-line mode.`false`No`modifiers``String`Raw regular expression [modifiers](http://php.net/manual/en/reference.pcre.pattern.modifiers.php). You can pass several modifiers as single string, and use raw modifiers with `ignoreCase` and `multiline` attributes. In case of conflict, value specified by dedicated attribute takes precedence.''No The previous example (using `modifiers` attribute this time): ``` <filterchain> <replaceregexp> <regexp pattern="ANT" replace="Phing" modifiers="i"/> <regexp pattern="(\w+)\.java" replace="\1.php"/> </replaceregexp> </filterchain> ```