Is there any way (a library, an algorithm, etc.) to identify and extract regular expressions from a (non-structured and random) string? For example, I am given the following string:
$betterline = ($line -match "\(\d+\)(?:\w+\(\d+\))+$") -replace "\(\d+\)", "."
and I would like to detect (\d+)(?:\w+(\d+))+$
and (\d+)
.
Even approximating solutions should do fine. I prefer python, but I can use other languages as well.