I'm looking for a function that can take multiple strings as an input, and create a regex that will match all of them.
For example, let's say the inputs are:
It should output something like:
/fun(ny)? dogs?/
I was wondering if Levenshtein distance could be used for such purpose, but no clue... what do you think?
You're not saying which flavor of regex. Perl comes with a thing called Regex::PreSuf
which does this sort of thing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.