Yeah, I understand what you mean. No worries.
On Dec 19, 11:10 pm, AlwaysCharging wrote:
> But that made me question why I couldn't just put the "/" inside of
> the bracket as well. Like why did that have to be escaped if the
> period didn't. (I guess it's because in that syntax, the forward
>
But that made me question why I couldn't just put the "/" inside of
the bracket as well. Like why did that have to be escaped if the
period didn't. (I guess it's because in that syntax, the forward
slash has closure properties.)
Oh well it's working now, and I escaped the . as well (\.).
Thank yo
hello iam maryam ihave peroblem ishal go aftenon by
On Sat, Dec 19, 2009 at 11:21 AM, ralu wrote:
>
>
> On Dec 18, 11:01 pm, AlwaysCharging wrote:
> > In my app, I allow users to submit urls. They (of course) need the
> > ability to submit urls with a forward slash, "/", but whats the
> > regu
It actually depends on where the "." is in the Regexp. In your case it
is inside a Character Class "[]". So it is matching the "." character
explicitly. Since \w is shorthand for the [a-zA-Z] character class. It
is parsed as a character class instead of an escaped "w" character. So
you could actual
Yes, that did it. Thank you.
No idea how I try everything and overlook the simplest solution, duh.
And, Thank you to everyone else that weighed in as well, definitely
some other options to look into.
Side note: Anybody know why the period doesn't have to be escaped?
Like just "." allows the dot
Use Ruby's other regexp syntax:
%r{pattern}
To continue your example below:
validates_format_of :url, :with => %r{^[-\w_./]+$}
AlwaysCharging wrote:
> In my app, I allow users to submit urls. They (of course) need the
> ability to submit urls with a forward slash, "/", but whats the
> regu
Sven Riedel wrote:
> /^http:\/\/myhostname\.com\/foo$/i
>
> would become
>
> %r{http://myhostname\.com/foo}i
And of course I forgot the anchors in the second example. So the correct
version is:
%r{^http://myhostname\.com/foo$}i
--
You received this message because you are subscribed to the Go
frogstarr78 wrote:
> Have you tried escaping them "\/"?
Another way would be to use %r, that way you can avoid the leaning
toothpick syndrome alltogether;
/^http:\/\/myhostname\.com\/foo$/i
would become
%r{http://myhostname\.com/foo}i
But before you start piecing your own regexp together have
Have you tried escaping them "\/"?
On Dec 18, 11:01 pm, AlwaysCharging wrote:
> In my app, I allow users to submit urls. They (of course) need the
> ability to submit urls with a forward slash, "/", but whats the
> regular expression to allow them to do that?
>
> I currently use:
>
> validates_f
On Dec 18, 11:01 pm, AlwaysCharging wrote:
> In my app, I allow users to submit urls. They (of course) need the
> ability to submit urls with a forward slash, "/", but whats the
> regular expression to allow them to do that?
>
> I currently use:
>
> validates_format_of :url, :with => /^[-\w\_.]
10 matches
Mail list logo