1

hi I need to use regex to vaildate an ajax call to an output log on a server - to check if a process therin is "finished". I have a php file that can give the last line of the log no mater what. Ajax goes and gets it 5 times a second. But I need to client side ratify it when done. The last line of the log (when finished) will be:

Just like any of these examples either "Total time: 2 seconds" or "Total time: 17 seconds" or "Total time: 1 minutes" I would like a regex to be able to identify that string no matter what the number

4

1 回答 1

3

/Total time: \d{1,} (seconds|minutes)/

1,如果您想将数字限制为 2-4 位或任何您想要的,您可以在之后添加一个上限。

于 2014-01-07T16:31:16.993 回答