<p>Something like this is on my mind: I put one or a few strings in, and the algorithm shows me a matching regex.</p>

<p>Is there an "<em>easy</em>" way to do this, or does something like this already exist?</p>

<p><strong><em>Edit 1</em></strong>: Yes, I'm trying to find a way to generate regex. </p>

<p><strong><em>Edit 2</em></strong>: Regulazy is not what I am looking for. The common use for the code I want is to find a correct RegEx; for example, article numbers:<br/></p>

<ul>
<li>I put in <em>123456</em>, the regex should be <code>\d{6}</code></li>
<li>I put in <em>nb-123456</em>, the regex should be <code>\w{2}-\d{6}</code></li>
</ul>

It sounds like you want an algorithm to generate a regular grammar based on some samples. In a lot of cases, there are many possible grammars for a given set of examples--there can even be infinite possible grammars. Of course, the possibilities can be limited by a second set of required
non
-matches, which can limit it to zero possibilities if the non-matching strings are too inclusive.
txt2re
does something like this.