Forum Discussion

Steph_282542's avatar
Mar 08, 2017

Need to use the [ ] characters in a wildcard parameter

I have a bunch of parameter created automatically on a website and I need to use a wildcard parameter for following type of params

 

items[0][varone] items[1][varone] items[1][vartwo]

 

it tried with:

 

items[?][] items/[?/]/[/] items[\d+][\w+]

 

I don't know how to use this [ bracket as a character in my wildcard param.

 

3 Replies

  • Hi Steph,

    the

    [
    and
    ]
    chars are used by RegEx to define "bracket expression", which can cover multiple chars at once (e.g.
    [a-zA-Z0-9]
    or
    [ABab01]
    ).

    If you need to specify the

    [
    and
    ]
    chars literally (aka. "as is"), within a regex pattern, without creating a "bracket expression", then you have to escape these chars by using a leading
    \
    char as shown below...

    Input String:

    items[0][varone] items[1][varone] items[1][vartwo]
    

    RegEx Pattern:

    items\[\d+\]\[\w+\] items\[\d+\]\[\w+\] items\[\d+\]\[\w+\]
    

    Note: You may tweak your RegEx pattern further, with this lovely online RegEx tester as required.

    Cheers, Kai

  • Hi Steph,

    okay I see what you're trying to accomblish. Well, if you read the following guide...

    https://support.f5.com/kb/en-us/products/big-ip_asm/manuals/product/config_guide_asm_10_2_0/asm_wildcard.html

    ... you'll notice that the ASM policy does not support RegEx syntax. Instead it supports only a rather simple

    shell-style wildcard
    syntax.

    Note: Please link the guide which states that you have to put a

    /
    in front of an
    *
    to have it as an explicit character.

    Cheers, Kai

  • Steph's avatar
    Steph
    Icon for Nimbostratus rankNimbostratus

    Many thanks for the suggestions, the problem was solved by using the "\", like this:

        items\[?\]\[*\]