ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# C.81 ReplaceRegexpTask Replaces the occurrences of a given regular expression with a substitution pattern in a selected file or set of files. Table C.110:聽 NameTypeDescriptionDefaultRequired`file``String`File to apply regular expression onn/aYes (or `fileset`)`match``String`Regular expression match patternn/aYes (or `pattern`)`pattern``String`Regular expression match patternn/aYes`replace``String`The replacement stringn/aYes C.81.1 Supported Nested Tags - `fileset` 1 PropertySelector Selects property names that match a given regular expression and returns them in a delimited list Table C.111:聽Attributes NameTypeDescriptionDefaultRequired`property``String`The name of the property to set.n/aYes`override``Boolean`If the property is already set, should we change it's value. Can be `true` or `false`falseNo`match``String`The regular expression which is used to select property names for inclusion in the list. This follows the standard regular expression syntax accepted by phing's regular expression tasks.n/aYes`select``String`A pattern which indicates what selection pattern you want in the returned list. This used the substitution pattern syntax to indicate where to insert groupings created as a result of the regular expression match.\\0No`casesensitive``String`Should the match be case sensitive.trueNo`replace``String`A regular expression substitition pattern, which will be used to replace the given regular expression in the subject.n/aYes (unless a match is specified)`casesensitive``Boolean`Should the match be case sensitivetrueNo`delimiter``String`The delimiter used to separate entries in the resulting property,No`distinct``Boolean`Should the returned entries be a distinct set (no duplicate entries).falseNo 1.1 Select expressions Expressions are matched in a the same syntax as a regular expression substitution pattern. - $0 indicates the entire property name (default). - $1 indicates the first grouping - $2 indicates the second grouping - etc... 1.2 Example ``` <property name="package.ABC.name" value="abc pack name" /> <property name="package.DEF.name" value="def pack name" /> <property name="package.GHI.name" value="ghi pack name" /> <property name="package.JKL.name" value="jkl pack name" /> <propertyselector property="pack.list" delimiter="," match="package\.([^\.]*)\.name" select="\1" casesensitive="false" /> ```