summaryrefslogtreecommitdiff
path: root/lib/gitlab/regex.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-02-13 13:26:33 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-02-13 22:30:10 +0200
commit2c55fd0019ea9ac33e310151a61892fada42d5a2 (patch)
treea658277ef7bea4390d8856755251be72b53b697f /lib/gitlab/regex.rb
parente5f446b7ca4bc54ffaf527e4c57dea2bee2f79f6 (diff)
downloadgitlab-ce-2c55fd0019ea9ac33e310151a61892fada42d5a2.tar.gz
Add GFM support to nested groupsdz-nested-groups-gfm-alt
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/gitlab/regex.rb')
-rw-r--r--lib/gitlab/regex.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index a3fa7c1331a..c77fe2d8bdc 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -13,6 +13,10 @@ module Gitlab
NAMESPACE_REGEX_STR = '(?:' + NAMESPACE_REGEX_STR_SIMPLE + ')(?<!\.git|\.atom)'.freeze
PROJECT_REGEX_STR = PATH_REGEX_STR + '(?<!\.git|\.atom)'.freeze
+ # Same as NAMESPACE_REGEX_STR but allows `/` in the path.
+ # So `group/subgroup` will match this regex but not NAMESPACE_REGEX_STR
+ NAMESPACE_REF_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.\/]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])(?<!\.git|\.atom)'.freeze
+
def namespace_regex
@namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze
end