Hi all,

i was trying to create a URL rewrite regex.

The regex is something similar to this:
\/pa\/([0-9,a-z,A-Z,-])

This regex works fine but i want to make this regex more dynamic so instead of "pa" i want that it matches any characters a user inputs.

I create a regexr test so you may understand better what i mean, link is: http://gskinner.com/RegExr/?368a2

Recommended Answers

All 2 Replies

What do you mean by any character?

.*      everything
[^\/]*  anything but a slash
\w+     at least one word character including digits and underscores
\w\w    exactly two

i mean that the first element between the slash (/pa/) can be /ps/ /pt/ or any other word

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.