Regex 每当URL中有大写字母时,响应路由器重定向

Regex 每当URL中有大写字母时,响应路由器重定向,regex,reactjs,url,react-router,uppercase,Regex,Reactjs,Url,React Router,Uppercase,我想在URL中有大写字母时解析它是否需要重定向到带有小写字母的URL 我在路径部分找到正确的正则表达式时遇到了一些问题 regex/:url2*([A-Z])/只有在所有字母都是大写时才起作用,而不是在这种情况下/home/Support/ 我在这里尝试了不同的道路,但没有任何运气 这是我的密码 <Route exact strict sensitive path=

我想在URL中有大写字母时解析它是否需要重定向到带有小写字母的URL

我在路径部分找到正确的正则表达式时遇到了一些问题

regex/:url2*([A-Z])/只有在所有字母都是大写时才起作用,而不是在这种情况下/home/Support/

我在这里尝试了不同的道路,但没有任何运气

这是我的密码

       <Route
              exact
              strict
              sensitive
              path='/:url2*([A-Z])/'
              render={props => {
                const path = props.location.pathname
                return <Redirect to={`${path.toLowerCase()}`} />
              }}
            />

{
const path=props.location.pathname
返回
}}
/>

我不是专家,但看看这是否适合你

<Route
    exact
    strict
    sensitive
    path='/:url([a-z/]*[A-Z]+[a-z/]*)/'
    render={props => {
        const path = props.location.pathname
        return <Redirect to={`${path.toLowerCase()}`} />
    }}
/>
{
const path=props.location.pathname
返回
}}
/>

正则表达式
/:url([a-z/]*[a-z]+[a-z/]*)/
检查url中是否至少有一个大写字母。

我不是专家,但看看这是否适合您

<Route
    exact
    strict
    sensitive
    path='/:url([a-z/]*[A-Z]+[a-z/]*)/'
    render={props => {
        const path = props.location.pathname
        return <Redirect to={`${path.toLowerCase()}`} />
    }}
/>
{
const path=props.location.pathname
返回
}}
/>
regex
/:url([a-z/]*[a-z]+[a-z/]*)/
检查url中是否至少有一个大写字母