ruby-regex: how to match for "/table[number]"?
i want to match for all "/table[number]"
so st开发者_开发知识库rings like "/table[1]" and "/table" are matched.
/\/table(?:\[\d+\])?/
Depending upon your needs, you may want to throw in word boundary markers as well. So
/\b\/table(?:\[\d+\])?\b/
Without these the regex would match strings like
/tables
/tableTop
.....
精彩评论