The most important thing to remember is that the pattern has to match the whole path. We're not searching for a pattern in the filename, we're trying to match the whole path against the pattern. Now let's get to some examples:

patterncomment
^.*/(build|mysource|mylogfile|Event2|Script|dir7|stuff).*will not match file "build/srs_build.py" because according to the pattern the "build" has to be preceded by "/"
^(build|mysource|mylogfile|Event2|Script|dir7|stuff)

will not match file "Script-Ruby/Dir1/source/test.rb" because the pattern doesn't match the whole filename 

^.*(Script|a\.bash).*

will match files:

"Script-Ruby/Dir1/source/test.rb"
"a.bash"

as well as:

"TotallyDifferentDirectory/Dir1/Obsolete_Script.rb.bak"
"bambawamba.bash.exe"

^.*/(Script|a\.bash).*

will match file:

"Programs/Script/source/test.rb"
as it is in the subdirectory and the path relative to workspace root will contain "/" before filename

but will not match file:

"a.bash"
as it is located in the root of workspace 

^/(Script-Ruby|a\.bash).*will not match "Script-Ruby/Dir1/source/test.rb" as it doesn't start with "/".

Hopefully this sheds some light on this area of Bamboo. If you have a question regarding the construction of regular expressions, you may want to ask that question on answers.atlassian.com.

  • No labels