2
Here is what I've tried so far :URL (문자열)에 언어를 추가/대체하려면 어떻게해야합니까?
/(?:\/(en(\?|$)|fa(\?|$)))|\?/
입력 :
http://localhost:8000/search/fa?q=sth
http://localhost:8000/search?q=sth
http://localhost:8000/search
http://localhost:8000/search/fa
예상 출력 :
http://localhost:8000/search/en?q=sth
http://localhost:8000/search/en?q=sth
http://localhost:8000/search/en
http://localhost:8000/search/en
알다시피, ?
과 일치해야하지만 선택하지 않아야합니다. 또한 세 번째 URL 끝에 /en
을 추가해야합니다.
내 패턴을 수정하려면 어떻게해야합니까? 이 여기
를 작동 할 수
는
그것은 훨씬 더 좋을 것이다. – Alex