# Accessing $arg\_PARAMETER for parameter with in it

**URL:** <https://www.ruby-forum.com/t/accessing-arg-parameter-for-parameter-with-in-it/221366>\
**Category:** NGINX\
**Created:** [July 11, 2012, 7:40am UTC](https://www.ruby-forum.com/t/accessing-arg-parameter-for-parameter-with-in-it/221366 "2012-07-11T07:40:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [July 11, 2012, 7:40am UTC](https://www.ruby-forum.com/t/accessing-arg-parameter-for-parameter-with-in-it/221366/1 "2012-07-11T07:40:03Z")

</div>

Hi,

I have a query string parameter that has a dot in it. For example,  
`a.b`. I need to write this parameter to my log file. How do I  
reference it?

I’ve tried `$arg_a.b` but that prints `-.b` (ie, it prints the value of  
$arg\_a which is - followed by .b)

I’ve also tried `$arg_a_b` but that just prints `-` since there is no  
parameter a\_b or a-b.

What should I do?

Posted at Nginx Forum:

> **[accessing $arg\_PARAMETER for parameter with . in it](https://forum.nginx.org/read.php?2,228490,228490#msg-228490)**
>
> Hi, I have a query string parameter that has a dot in it. For example, \`a.b\`. I need to write this parameter to my log file. How do I reference it? I've tried \`$arg\_a.b\` but that prints \`-.b\` (ie, it prints the value of $arg\_a which is - followed by...

---

<div class="post-metadata">

**Author:** ![bluesmoon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f8ce5/32.png) [@bluesmoon](https://www.ruby-forum.com/u/bluesmoon)\
**Post date:** [July 11, 2012, 6:49pm UTC](https://www.ruby-forum.com/t/accessing-arg-parameter-for-parameter-with-in-it/221366/2 "2012-07-11T18:49:40Z")

</div>

I’ve also tried ${arg\_a.b} and nginx -t tells me that the closing  
bracket in “arg\_a” variable is missing

Posted at Nginx Forum:

> **[Re: accessing $arg\_PARAMETER for parameter with . in it](https://forum.nginx.org/read.php?2,228490,228506#msg-228506)**
>
> Hi, I have a query string parameter that has a dot in it. For example, \`a.b\`. I need to write this parameter to my log file. How do I reference it? I've tried \`$arg\_a.b\` but that prints \`-.b\` (ie, it prints the value of $arg\_a which is - followed by...

---

<div class="post-metadata">

**Author:** ![bluesmoon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f8ce5/32.png) [@bluesmoon](https://www.ruby-forum.com/u/bluesmoon)\
**Post date:** [July 11, 2012, 9:15pm UTC](https://www.ruby-forum.com/t/accessing-arg-parameter-for-parameter-with-in-it/221366/3 "2012-07-11T21:15:08Z")

</div>

Hello!

On Wed, Jul 11, 2012 at 01:39:19AM -0400, bluesmoon wrote:

> parameter a\_b or a-b.
> 
> What should I do?

The $arg\_\* variables won’t allow you to access request arguments with  
characters not allowed in variable names.

If you really need to, you may parse $args yourself, e.g. with  
map{} directive using regular expressions. Something like this  
should work:

```
map $args $ab {
    "~(?:^|[&;])a[.]b=(?<foo>[^&;]*)" $foo;
}

```

Maxim D.

---

<div class="post-metadata">

**Author:** ![bluesmoon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5f8ce5/32.png) [@bluesmoon](https://www.ruby-forum.com/u/bluesmoon)\
**Post date:** [July 11, 2012, 10:35pm UTC](https://www.ruby-forum.com/t/accessing-arg-parameter-for-parameter-with-in-it/221366/4 "2012-07-11T22:35:11Z")

</div>

Maxim D. Wrote:

> If you really need to, you may parse $args  
> yourself, e.g. with  
> map{} directive using regular expressions.

thanks, I’ll try that.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,228490,228511#msg-228511](http://forum.nginx.org/read.php?2,228490,228511#msg-228511)
