web.config redirect url

I am trying to set up a rewrite url in my iis web.config file.

something like this:
 <rule name="car-donation pages">
<match url="^car-donation-(.*)-(.*).asp$" />
<action type="Rewrite" url="car-donation.php?city={R:1}&state={R:2}" />
</rule>

Open in new window


These are sample of pages that are coming in
car-donation-omaha-ne.asp
car-donation-tucson-az.asp

I need to get the name after the 2nd dash as city and the words after the 3rd dash is for state.

But I am running into an issue that i have some cities that have dashes in it.
car-donation-new-orleans-la.asp
car-donation-san-antonio-tx.asp
and even
car-donation-new-york-city-ny.asp

really if it would be possible to separate it
-  'car-donation- '
- whatever is here is city
- extra dash '-'
- these 2 characters is the states
- '.asp' (at the end)

How can I set that up?
rivkamakAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
first thought was that you need to write another 2 rules to handle various instance of the states which may contain more "-" in their names, but after tested your existing rule, it seems it's working fine to handle all of your states

SnapShot.png
Untitled.png
Untitled1.png

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.