cron表达式 正则英语
## Cron Expressions in English.
Cron expressions are used to define schedules for tasks in the Unix-like operating systems. They are comprised of six fields, each of which represents a different unit of time. The fields are:
Minute.
Hour.
Day of month.
Month.
Day of week.
Year (optional)。
Each field can be specified using a variety of values, including:
Asterisk (``): Matches any value in the field. For example, `` in the minute field matches every minute.
Number: Matches the specified value in the field. For example, `10` in the hour field matches 10:00 AM.
Range: Matches any value within the specified range. For example, `1-10` in the minute field matches every minute from 1:00 AM to 10:00 AM.
List: Matches any value in the specified list. For example, `1,3,5` in the day of month field matches the 1st, 3rd, and 5th day of the month.
Step: Matches every nth value in the field. For example, `/2` in the minute field matches every other minute.
In addition to these basic values, cron expressions also support a number of special characters:
Comma (`,`): Separates multiple values in a field.
Dash (`-`): Specifies a range of values in a field.
Slash (`/`): Specifies a step value in a field.
Question mark (`?`): Matches any value in a field, but only if the previous field is also matched.
For example, the following cron expression matches every minute of every hour on the 1st and 15th day of every month:
0 1,15。
The following cron expression matches every minute of every hour on weekdays:
0 1-5。
The following cron expression matches every minute of every hour on the first day of every month:
0 1。
Cron expressions can be used to schedule tasks with a variety of different frequencies. They are a powerful tool for automating tasks and ensuring that they are run at the desired time.
## Examples of Cron Expressions.
Here are some examples of cron expressions and their corresponding schedules:
` `: Every minute.
`0 `: Every hour.
正则化英文 `0 0 `: Every day at midnight.
`0 0 1 `: Every day at 1:00 AM.
`0 0 1 `: Every day at 1:00 AM.
`0 0 1-5`: Every day at midnight on weekdays.
`0 0 6,0`: Every day at midnight on Saturday and Sunday.
`0 0 1 1 `: The first day of every month at 1:00 AM.
`0 0 15 1 `: The 15th day of every month at 1:00 AM.
`0 0 1-5`: Every day at midnight on weekdays.
`0 0 17 `: Every day at 5:00 PM.
`0 0 17 `: Every day at 5:00 PM.
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论