Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
what's wrong with my method and regular expression?
equinox
12/18/2008 12:07:00 AM
The code is
http://pastie....
And i want it to return
nil
www.yahoo.co.in
/~testing/i.html
but when I run this code, why doesn't the www.yahoo.co.in detected?
3 Answers
Chris Hulan
12/18/2008 1:04:00 AM
0
On Dec 17, 7:07 pm, equinox <aditya15...@gmail.com> wrote:
> The code is
>
>
http://pastie....
>
> And i want it to return
>
> nilwww.yahoo.co.in
> /~testing/i.html
>
> but when I run this code, why doesn't thewww.yahoo.co.indetected?
You might want to play with your regex on Rubular (http://
rubular.com/)
A little experimentation shows that you probably want to include
'http://'
in your input string
cheers
equinox
12/18/2008 1:08:00 AM
0
On Dec 17, 6:04 pm, Chris Hulan <chris.hu...@gmail.com> wrote:
> On Dec 17, 7:07 pm, equinox <aditya15...@gmail.com> wrote:
>
> > The code is
>
> >
http://pastie....
>
> > And i want it to return
>
> > nilwww.yahoo.co.in
> > /~testing/i.html
>
> > but when I run this code, why doesn't thewww.yahoo.co.indetected?
>
> You might want to play with your regex on Rubular (http://
> rubular.com/)
> A little experimentation shows that you probably want to include
> 'http://'
> in your input string
>
> cheers
the code should work for both, if there's no http:// then it should
print out:
nil
www.yahoo.co.in
/~testing/i.html
if there is then it should print:
http
www.yahoo.co.in
/~testing/i.html
equinox
12/18/2008 1:16:00 AM
0
On Dec 17, 6:08 pm, equinox <aditya15...@gmail.com> wrote:
> On Dec 17, 6:04 pm, Chris Hulan <chris.hu...@gmail.com> wrote:
>
>
>
> > On Dec 17, 7:07 pm, equinox <aditya15...@gmail.com> wrote:
>
> > > The code is
>
> > >
http://pastie....
>
> > > And i want it to return
>
> > > nilwww.yahoo.co.in
> > > /~testing/i.html
>
> > > but when I run this code, why doesn't thewww.yahoo.co.indetected?
>
> > You might want to play with your regex on Rubular (http://
> > rubular.com/)
> > A little experimentation shows that you probably want to include
> > 'http://'
> > in your input string
>
> > cheers
>
> the code should work for both, if there's no http:// then it should
> print out:
>
> nilwww.yahoo.co.in
> /~testing/i.html
>
> if there is then it should print:
>
> httpwww.yahoo.co.in
> /~testing/i.html
anyway thanks for the rubular link I was able to fix the code using
it...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
what's wrong with my method and regular expression?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password