# Regex issue

**URL:** <https://community.f5.com/t/regex-issue/73453>\
**Category:** Technical Forums\
**Tags:** asm, waf, regex, security, wildcard, application-delivery\
**Created:** [November 10, 2023, 10:40am UTC](https://community.f5.com/t/regex-issue/73453 "2023-11-10T10:40:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darius44](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@Darius44](https://community.f5.com/u/Darius44)\
**Post date:** [November 10, 2023, 10:40am UTC](https://community.f5.com/t/regex-issue/73453/1 "2023-11-10T10:40:08Z")

</div>

Hello,

I am stuck on trying to find out how to match some parameters in a WAF request using regex wildcard

The parameters that I want to match are int the form of&nbsp;_amp;arg20=something_&nbsp;where the arg20 can be anything.

The repetitive part that I want to match with the regex is amp; and I want to match multiple times because it appears multiple times in the query string

This is the request

```auto
<span class=""><span class="">GET /human.aspx?r=2900376326&</span></span><span class=""><a class="" href="https://10.179.136.48/dms/policy/requests_ng.php#" target="_blank" rel="noopener nofollow noreferrer">amp;arg20=dssdds</a></span><span class=""><span class="">&</span></span><span class=""><a class="" href="https://10.179.136.48/dms/policy/requests_ng.php#" target="_blank" rel="noopener nofollow noreferrer">amp;arg21=aaa</a></span><span class=""><span class=""> HTTP/1.1</span></span>

```

I want to match the 2 parameters amp;arg20 and amp;arg21 with a wildcard which appears as invalid parameters

| Parameter Location | Query String |
| --- | --- |
| Parameter Name | amp;arg20 |
| Parameter Value | dssdds |
| Applied Blocking Settings | Block&nbsp;Alarm&nbsp;Learn |

* * *

| Parameter Location | Query String |
| --- | --- |
| Parameter Name | amp;arg21 |
| Parameter Value | aaa |
| Applied Blocking Settings | Block&nbsp;Alarm&nbsp;Learn |

I tried to create multiple wildcard parameters like: _amp.\*_ or _amp.+?(?==)_&nbsp;but the parameters never match and I get the illegal parameter violation

How can this be achieved?

---

<div class="post-metadata">

**Author:** ![Darius44](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@Darius44](https://community.f5.com/u/Darius44)\
**Post date:** [November 10, 2023, 10:41am UTC](https://community.f5.com/t/regex-issue/73453/2 "2023-11-10T10:41:16Z")

</div>

I attahced the wildcard parameter entry that I have created

---

<div class="post-metadata">

**Author:** ![Niels\_van\_Sluis](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/niels_van_sluis/32/3759_2.png) [@Niels\_van\_Sluis](https://community.f5.com/u/Niels_van_Sluis)\
**Post date:** [November 10, 2023, 10:59am UTC](https://community.f5.com/t/regex-issue/73453/3 "2023-11-10T10:59:01Z")

</div>

You can try this:

```regex
amp;arg2[01]

```

This site can help you test your regular expressions:

[regex101: build, test, and debug regex](https://regex101.com/)

---

<div class="post-metadata">

**Author:** ![Darius44](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@Darius44](https://community.f5.com/u/Darius44)\
**Post date:** [November 10, 2023, 11:05am UTC](https://community.f5.com/t/regex-issue/73453/4 "2023-11-10T11:05:34Z")

</div>

Hello,

Thank you for your answer.

I tried it and it still doesn’t work.

Anyway there is the posibility that the parameters in the request will be amp;Arg02 or amp;arg100 or even amp;Opt10

The regex in my opinnion should match any parameter that starts with this string amp; and then anything else untill the = sign

I also tried it on the regex website and even on the f5 regex tester and the regex appears to be ok but when I try to use it in the policy it fails

---

<div class="post-metadata">

**Author:** ![Niels\_van\_Sluis](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/niels_van_sluis/32/3759_2.png) [@Niels\_van\_Sluis](https://community.f5.com/u/Niels_van_Sluis)\
**Post date:** [November 10, 2023, 11:11am UTC](https://community.f5.com/t/regex-issue/73453/5 "2023-11-10T11:11:46Z")

</div>

This?

```regex
amp;[a-zA-Z0-9]+=

```

---

<div class="post-metadata">

**Author:** ![Darius44](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@Darius44](https://community.f5.com/u/Darius44)\
**Post date:** [November 10, 2023, 11:16am UTC](https://community.f5.com/t/regex-issue/73453/6 "2023-11-10T11:16:43Z")

</div>

Same

Just to be sure that I am doing it correctly I attached the parameter creation page and the error that I get

---

<div class="post-metadata">

**Author:** ![Darius44](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@Darius44](https://community.f5.com/u/Darius44)\
**Post date:** [November 10, 2023, 12:01pm UTC](https://community.f5.com/t/regex-issue/73453/7 "2023-11-10T12:01:02Z")

</div>

I somehow got it to work with this solution (not sure why it wasn’t working before)

amp;[a-zA-Z0-9]\*

---

<div class="post-metadata">

**Author:** ![Niels\_van\_Sluis](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/niels_van_sluis/32/3759_2.png) [@Niels\_van\_Sluis](https://community.f5.com/u/Niels_van_Sluis)\
**Post date:** [November 10, 2023, 12:10pm UTC](https://community.f5.com/t/regex-issue/73453/8 "2023-11-10T12:10:55Z")

</div>

Nice!
