# Regular expression regex question

**URL:** https://forum.kirupa.com/t/regular-expression-regex-question/328202
**Category:** Uncategorized
**Created:** [April 26, 2012, 5:28pm UTC](https://forum.kirupa.com/t/regular-expression-regex-question/328202 "2012-04-26T17:28:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![flashdaddy](https://avatars.discourse-cdn.com/v4/letter/f/e36b37/32.png) [@flashdaddy](https://forum.kirupa.com/u/flashdaddy)
#### Post date: [April 26, 2012, 5:28pm UTC](https://forum.kirupa.com/t/regular-expression-regex-question/328202/1 "2012-04-26T17:28:40Z")

</div>

Hey All,

I’m having a tough time trying to understand how to do a regular expression. My string looks something like this:

```auto
http://my_url_is_here&&.xml?key=value&key=value&&

```

so I’m trying to write a regular expression to remove the &&.xml and to remove the && at the end. The URL is dynamically generated, so there may be just one & or there could be 5 so I need to remove all of them This is what i have

```auto
my_string = my_string.replace(/(&*.xml)/g, ".xml");

```

That is good if i just want to remove the && before the xml, but i’m trying to actually remove any instances of the “&” before the .xml and any instances of “&&” at the end of the string.

I searched the documentation (link below) and it got me this far [http://help.adobe.com/en\_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7eab.html](http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7eab.html)

Any feedback would be much appreciated.
