Help on Regular Expression for Cronjob testing

I need a small test for Cronjob entries...

things like */5 can be ignored

this works...


i would appreciate any comments
(i am neither an expert in perl nor in regex ....i think in the perl topic i can find the most regex gurus)

so please let me know if this is good

greetz andy
Who is Participating?
ozoConnect With a Mentor Commented:
/^\s*\w+\s*=\s*.*/ || /\s*#.*/ || /^\s*\@(reboot|yearly|annually|monthly|weekly|daily|midnight|hourly)\s+.*/  ||
AndyWHVAuthor Commented:
i need the time only (no command...) so the expression may end when all the time is specified...
i modified yours a bit because i experienced errors on months and weekdays with my tests
(\/\d\d?) here should follow always a ? you did in minutes,hours and days, right ?

 /^\s*\w+\s*=\s*.*/ || /\s*#.*/ || /^\s*\@(reboot|yearly|annually|monthly|weekly|daily|midnight|hourly)\s+.*/  ||

thank you for this amazing help :-)

now it seems pretty good
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.