tags:

views:

40

answers:

2

i want to match for all "/table[number]"

so strings like "/table[1]" and "/table" are matched.

+2  A: 
/\/table(?:\[\d+\])?/
S.Mark
This is definitely most of the solution, but I like Jasmeet's suggestion to also include word boundaries.
James A. Rosen
+1  A: 

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
.....

Jasmeet