问题
I'm writing some Selenium tests and need to confirm the presence of a text string that has dynamic date and currency components.
Example: "This is the date dd/dd/dd and this is the amount $ddd.dd."
Is this possible with the Selenium regex implementation?
Thanks, Richard
回答1:
If I'm not mistaken selenium supports the full power of javascript
Date dd/mm/yyyy
01/01/1900 through 31/12/2099
Matches invalid dates such as February 31st
Accepts dashes, spaces, forward slashes and dots as date separators
(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)[0-9]{2}
Currency
\$\d*(\.\d*)?
来源:https://stackoverflow.com/questions/10971209/selenium-regex-match-literal-string-with-dynamic-date