RegExp in JavaScript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

RegExp in JavaScript

Post by mzfp2 »

Hi all

right, I really hate regular expressions, so I need help constructing the following

I need to extract my url from a string, which could either be 'http://alljammin.com/' or 'http://www.alljammin.com/' or just 'www.alljammin.com/'

leaving me with the reamainder of the string

so for instance

'http://www.alljammin.com/shizzle'

should leave me with 'shizzle'

Thanks for all ya help!

http://www.alljammin.com !
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

without meaning too sound nasty

you have been asking pretty much the same question to do the same thing for ages now

go here for your answer

hope that helps
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Post by mzfp2 »

well yeah its do with the same thing, but its a totally different question, i aint asked bout reg expressions before! and its wot this forum is here for .. i'm only asking for help, and i appreciate the people who help me out!

and thanks for your help too bubba!
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

*cough*look!*cough*

edit: the answer to the problem you are trying to overcome is in that page
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Post by mzfp2 »

that's all to do with trapping the request for a page that doesnt exist, i've managed to do that now, soo all i need to do is use a reg exp, but reg expressions really scare me man, which is why I asked !!
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

couldnt you do something like

click here

took me 5 seconds scouring php.net :?
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Post by mzfp2 »

I'm not using PHP, its a html page
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

ah, im sorry for the confusion i searched arund and found some things that may be of use to you

here
here
very helpful
here

hope these help
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Post by mzfp2 »

thanks man, you're a star, I will send u a huge check when im rich !

it cud happen!
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

lol good luck

just remember, search engines are a programmers best friend :lol:
Post Reply