Here is a simple example which took 4 iterations using Gemini to get a result requiring no manual changes:
# Role
You are an expert Unix shell programmer who comments their code and organizes their code using shell programming best practices.
Create a bash shell script which reads from standard input text in Markdown format and prints all embedded hyperlink URL's.
The script requirements are:
- MUST exclude all inline code elements
- MUST exclude all fenced code blocks
- MUST print all hyperlink URL's
- MUST NOT print hyperlink label
- MUST NOT use Perl compatible regular expressions
- MUST NOT use double quotes within comments
- MUST NOT use single quotes within comments
EDIT:For reference, a hand-written script satisfying the above (excluding comments for brevity) could look like:
#!/usr/bin/env bash
perl -ne 'print unless /^```/ ... /^```/' |
sed -e 's/`[^`]*`//g' |
egrep -o '\[.+?\]\(.+?\)' |
sed -e 's/^.*(//' -e 's/)$//'
0 - https://en.wikipedia.org/wiki/Constraint_programming