양식에서 보낸 HTML 텍스트에 url 또는 urls가 포함되어 있는지 검색하고 필터링하고 싶습니다.html 텍스트에 url 존재 여부 확인
RESOURCES<br></u></b><a target="_blank" rel="nofollow" href="http://stackoverflow.com/users/778094/hyperrjas">http://stackoverflow.com/users/778094/hyperrjas</a> <br><a target="_blank" rel="nofollow" href="https://github.com/hyperrjas">https://github.com/hyperrjas</a> <br><a target="_blank" rel="nofollow" href="http://www.linkedin.com/pub/juan-ardila-serrano/11/2a7/62">http://www.linkedin.com/pub/juan-ardila-serrano/11/2a7/62</a> <br>
나는 HTML 텍스트에서 또는 다양한 URL/URL을 허용하지 않습니다
예를 들어, 내가 양식에서이 HTML을 보낼 수 있습니다. 이 같은 수 : html로 텍스트가 각종 URL을 포함하는 경우 내가 알고 싶습니다
validate :no_urls
def no_urls
if text_contains_url
errors.add(:url, "#{I18n.t("mongoid.errors.models.profile.attributes.url.urls_are_not_allowed_in_this_text", url: url)}")
end
end
을, 어떻게 필터링 할 수 있습니다?