#!/usr/local/bin/node var text = 'てすとですよ。0H' var rule = 'text.match(/ですよ/)&&text.match(/[0-9]+H/)' var flg try{ flg = eval(rule) }catch(e){ flg = false } if(flg){ console.log('matched') }else{ console.log('unmatched') }