Forum Discussion

judym's avatar
judym
New Contributor
13 years ago

Assertion Regular Expression: match count

New to the boards, I tried to find any similar existing question, but could not find one... I apologize if this is a duplicate.

Running an assertion on my results with a regular expression. I basically want to do a count on results to demonstrate we're getting the max or less results back.

If we set a limit to only see 10 at a time, we could end up with 0 to 10, but not over 10.
The regular expression SHOULD be something like such:
(?s).*(<repeatelement.*){0,10}(?s).*

Let's assume I have a full 10 results being returned it passes, which is good. But if I change it to {0,9} it still passes, when it should not.

The exact match (example below) works fine in that if I then say 11 instead of 10 I get a failure.
(?s).*(<repeatelement.*){10}(?s).*

Please, what am I missing... before I end up bald!

1 Reply

  • judym's avatar
    judym
    New Contributor
    Hoping for a pretty answer still... but will go with the less than elegant solution in the mean time, one contains (check for 10) and one does not contains (check for 11).