How to with extract url from tweet using Regular Expressions

Posted by neutreno on Stack Overflow See other posts from Stack Overflow or by neutreno
Published on 2012-03-24T17:25:52Z Indexed on 2012/03/24 17:29 UTC
Read the original article Hit count: 220

Filed under:
|
|

Ok so i'm executing the following line of code in javascript

RegExp('(http:\/\/t.co\/)[a-zA-Z0-9\-\.]{8}').exec(tcont);

where tcont is equal to some string like 'Test tweet to http://t.co/GXmaUyNL' (the content of a tweet obtained by jquery).

However it is returning, in the case above for example, 'http://t.co/GXmaUyNL,http://t.co/'.

This is frustracting because I want the url without the bit on the end - after and including the comma.

Any ideas why this is appearing? Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex