I need to get the values of img= via= title=. Is there a smart way to do it or does it just require a lot of split and join?
The content will be always different. Thanks
I need to get the values of img= via= title=. Is there a smart way to do it or does it just require a lot of split and join?
The content will be always different. Thanks
have you tried using regular expressions? It seems like the perfect fit for this.
Basically I would separate the http://www.example.com/#section/ from img=http://example.org/mypic.jpg/via=example.org/blog/pictures/title=Hello-World
then use another regex to split the three different values most uris use another character that can act as a separator. look at http://en.wikipedia.org/wiki/URI_scheme
Semicolon: key1=value1;key2=value2;key3=value3
Ampersand: key1=value1&key2=value2&key3=value3
this makes creating regular expressions easier, because you look for anything between the separators.
you would then end up with an array of three strings 
key1=value1 key2=value2  and key3=value3 you can do another regex where you separate on the = and end up with an array that holds the key/value pair.
If you know your regular expression well, you might be able to do it with fewer expressions.
the tool I always use is http://regexpal.com to craft my expressions. but you might be able to find something in http://regexlib.com/ though they probably utilize the & or ;
var inbetween:RegExp = /img=(.*?)\/via/g; var imgmatch:Object = inbetween.exec(my.text); var imgpath = imgmatch[1];