what's wrong with my method and regular expression?

C

Chris Hulan

The code is

http://pastie.org/341880

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
 
E

equinox

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
 
E

equinox

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top