
21 Oct
2020
21 Oct
'20
12:15 p.m.
[why] simplify string match operate. Signed-off-by: Tong Qunfeng <taxcom@tom.com> --- src/lib/job.cr | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/job.cr b/src/lib/job.cr index 12d3980..8dad205 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -22,9 +22,8 @@ end module JobHelper def self.match_tbox_group(testbox : String) tbox_group = testbox - find = testbox.match(/(.*)(\-\d{1,}$)/) - if find != nil - tbox_group = find.not_nil![1] + if testbox =~ /(.*)-\d+$/ + tbox_group = $1 end return tbox_group end -- 2.23.0