This question is tagged "perl" as well as awk and sed and asks about a regular expression.
Find number in string and replace it
At what point do questions that are answered with programs move from our scope to SO?
It's a really fuzzy area.
On one hand, we can't retroactively judge a question as topical or not based on what kind of answers it gets. If a question is asked that appears on the surface to be topical, but then all the valid answers involve some programming, it's not suddenly off-topic. We can't expect a user to know beforehand the complete implications of the question they're asking. And if they're getting good answers here, ones that solve their problem, there is not a strong case for migration. Migration is only really useful when the answers they get here are poor, too general, not helpful, etc.
On the other hand, questions that themselves ask about actual programming languages (how do I do X in Python, Bash, etc.), are more likely to be considered off-topic and migrated to SO. If the question contains either significant code (in some programming language) or a request for code in some specific language(s), it's clear that the querant understands that this is the domain of programmers or at least sysadmins, and not so much power users.
If it were me, the original question you posted would've been voted close to migrate to SO, but the OP has already accepted an answer, so it's clear that the subject matter was in the area of expertise of SU users. It makes almost zero sense to migrate a question with an accepted answer to another site, especially if the user is completely satisfied with that answer.
Migration due to better-suitedness of a topic to SO is primarily reserved, in my mind, for questions that get very poor answers (or no answers at all) on SU, and for whom the subject matter is pretty clearly applicable to SO. And the question can't be crap, either: electronic fecal matter only flows in one direction on the StackExchange network; from SO to other sites.... but if we do our job (and we generally do), not in the opposite direction.