Sometimes, I want to test is my regex correct.
How can I do reverse regex
match from stdin?
F.e. I can match a string with provided regex, like:
grep "\(foo\)-bar"
foo
bar
foo-bar
foo-bar #Match found
What I would like to do, is the opposite, something like this:
$ grep "This is one string"
\(This\) #Will send "This" to stdout
This?.* #Will send full match
Is this somehow possible without much scripting?