No, JavaScript RegExp does not allow searching from the end of the string. The usual workaround is using a greedy dot matching pattern to make the engine grab the whole string and then backtrack to find the last occurrence (as /.*a\d/), but it will become a pain if a large string does not really contain this pattern.