Sets project properties based on the evaluatuion of a regular expression.
For a list of all members of this type, see RegexTask Members.
System.Object
NAnt.Core.Element
NAnt.Core.Task
NAnt.Core.Tasks.RegexTask
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
The Pattern attribute must contain one or more named grouping constructs, which represents the names of the properties to be set. These named grouping constructs can be enclosed by angle brackets (?<name>) or single quotes (?'name').
Note In the build file, use the XML element < to specify <, and > to specify >.
Note The named grouping construct must not contain any punctuation and it cannot begin with a number.
Find the last word in the given string and stores it in the property lastword
.
<regex pattern="(?'lastword'\w+)$" input="This is a test sentence" /> <echo message="${lastword}" />
Split the full filename and extension of a filename.
<regex pattern="^(?'filename'.*)\.(?'extension'\w+)$" input="d:\Temp\SomeDir\SomeDir\bla.xml" />
Split the path and the filename. (This checks for /
or \
as the path separator).
<regex pattern="^(?'path'.*(\\|/)|(/|\\))(?'file'.*)$" input="d:\Temp\SomeDir\SomeDir\bla.xml" />
Results in path=d:\Temp\SomeDir\SomeDir\
and file=bla.xml
.
Namespace: NAnt.Core.Tasks
Assembly: NAnt.Core (in NAnt.Core.dll)
RegexTask Members | NAnt.Core.Tasks Namespace