Reputation: 1569
Hi I'm creating a regular expression (ruby) to test the beginning and end of string. I have both parts but can't join them.
Beginning of string
\A(http:\/\/+)
End of string
(.pdf)\z
How to join?
Bonus if it could validate in-between and accept anything (to avoid http://.pdf
)
By the way, rubular http://rubular.com is a neat place to validate expressions
Upvotes: 0
Views: 89
Reputation: 7804
Use .+
to match any character except \n one or more times.
\A(http:\/\/+).+(\.pdf)\z
Should match http://www.stackoverflow.com/bestbook.pdf
but not http://.pdf
Upvotes: 1