Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Couldn't find a function for this. I'm assuming I need to use regex?

I'm trying to do html redirects in php in cases where the url contains at least 1 upper case letter.

example: http://www.domain.com/Michael_Jordan needs to be redirected to http://www.domain.com/michael_jordan - only problem is I can't seem to find a script to detect if at least 1 capital letter exists.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
779 views
Welcome To Ask or Share your Answers For Others

1 Answer

Some regular expression should be able to the work, you can use preg_match and [A-Z]

if(preg_match('/[A-Z]/', $domain)){
 // There is at least one upper
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...