I had been looking on the Internet for a solution to a program I had be working on and sadly didn’t come up with one. I was trying to find a way to use regular expressions to find all the html anchor tags in a string along with matching a wild card URL (ie: secnem.com.*test.html). And after many hours of thrusting my head into my keyboard I came up with:

/<a [^><]*href=[\”\’][^\”\’><]*<rule>[^\”\’><]*[\”\’][^>]*>\s*.*\s*<\/a>/iU

You’d replace <rule> with what ever url rule you want, except for any wild cards in the url I needed to use [^\”\’><]* instead of just .* . This would prevent it from matching outside of the anchor. Bascially [^\”\’><]*  means: match any character except a double quote, single quote, greater than sign, or less than sign. All of which should not be in the href field to begin with.

If you wanted to see what the content of the anchor tag was or the matched href, simply put some brackets around like so:

/<a [^><]*href=[\”\’]([^\”\’><]*<rule>[^\”\’><]*)[\”\’][^>]*>(\s*.*\s*)<\/a>/iU

Hope this helps someone. You can of course adapt this to other html tags by replacing ‘a’ for ‘table’ or w/e. Same with the href. larsolavtorvik.com has a great resource for testing regex in real time and addedbytes.com has a great cheat sheet as well.

Previous ArticleNext Article
m.

mobile radio

So I finally figured out how to stream radio to my phone. More specifically 1.FM radio. The problem came with the fact that 1.FM uses MMS to stream their radio which would work on most non-java smartphones. Unfortunately I have a u740 Java phone and so it doesn’t work.

So after about 6 months of sporatic work, I finally figured it out. I had to use VLC as a encoder to tranform the MMS stream to a mp4-latm RTP stream. After that, then use Darwin Streaming Server to take the RTP stream from VLC and broadcast it using the RTSP protocol.

So yea, now I can rock away and tell my cell company to take that 7.00/month radio package and shove it.

O.

Ohhh Cellular-Ma-Fone.

I lost Samsung u740 two days ago and I’ll be honest… I feel mildly useless with out it. I mean I didn’t store anything incredibly important on it besides my contacts, but still! I’ve already run into situations while on the road or away from home where I’ve needed a phone… so terrible. But to top things off, I burnt myself on a Shindaiwa T230 trimmer on the same day!

But on the bright side I bought a HTC Touch Diamond on eBay for like $200, which is pretty damn good considering my retarded cellular company sells them for well over $400. What I did find the most interesting about those retards is they only use the location feature to find your phone in the case of an emergency (normally for the paramedics to find you) and it requires a court order. But I have to wonder… why do I (the owner of the phone) need to have an emergency and a court order to find my own phone? Their response: Wut?

I did however learn something from them about the streaming radio issue I previously had with the Samsung u740. The other cellular company they were partnered with provided an RTSP relay in the network which solved the problem of not being able to use RTSP streaming. Since they are no longer partnered… no more relay, but is my cell company going to fix it? Apparently there is no estimated on a fix for the ‘issue’. Fantastic.