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

1
  • The regex you need is "Total time: \d+ (seconds|minutes)" Commented Jan 7, 2014 at 16:31

1 Answer 1

3

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

you can add an upper limit after the 1, if you'd like to limit the number to 2-4 digits or whatever you want.

Sign up to request clarification or add additional context in comments.

2 Comments

You could anchor it also to prevent substring matches
how do you mean Alex?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.