1. leapfrogdevelopment
  2. rstr
  3. Issues
Issue #2 closed

Allow Configurable STAR_PLUS_LIMIT

Kenny Trytek
created an issue

The limit for 'plus' and 'star' repeats has a default value of 100 characters. This allows xeger to produce some unwieldy strings.

For example, if I have a URL pattern defined as '/api/<:(\d+)>/resource/<:([^/]+)>', I might get this output: '/api/284363015419759338888426842686875549135031154628187059069994662154680100219440/resource/\x0b6yR9e1dh(",NDfR|zf:cwx}\nJ=G $&6o'.

If I can limit the output length, however, I can achieve a much more manageable output: '/api/62874/resource/nql2a'

Comments (4)

  1. Brendan McCollam

    What about just setting the number of characters you want in the regex itself? For example,

    >>> import rstr
    >>> rstr.xeger(r'/api/\d{1,8}/resource/\w{1,8}')

    The STAR_PLUS_LIMIT is really just meant as a backstop to keep people from getting truly insanely long strings when they use * and + in their expressions.

  2. Log in to comment