コード風プロンプト例4a 正規表現マッチング
Executes regex pattern matching on input text and outputs corresponding results.
/plugin marketplace add kokuyouwind/claude-plugins/plugin install code-like-prompt@kokuyouwind-plugins{"text": string}Emulate the following code internally (without using external tools or interpreter) with environment: $ARGUMENTS
Output only what putStrLn commands would output. Do not show any explanations, code, variables, or other messages.
import Text.Regex.Posix ((=~))
main :: IO ()
main = do
-- Validate required arguments
let text = case lookupArg "text" of
Nothing -> error "Required argument 'text' is missing"
Just t -> t
-- Pattern matching with guards
case text of
_ | text =~ "^foo.*bar$" -> putStrLn "qux"
| text =~ "^baz" -> putStrLn "quux"
| otherwise -> putStrLn "corge"