Your Digital Media Has Never Looked So Good

 
cpawinsal
Topic Author
Posts: 20
Joined: Fri Aug 20, 2010 1:13 pm

Seaching Strings with Escapes

Fri Aug 20, 2010 1:21 pm

Hi,

I have a little problem. I have a server (written in Java) that was returning some links to me to play on my Roku. The server was able to successfully build a link to the mp4 files I was looking for, but they don't work on the Roku. This is because I was grabbing a key from an HTML source via my Java code which is on a server with a different IP than a local user's Roku box. So, the server links won't work. I have to build the links on the Roku itself.

To that end, I recreated this code on the Roku but got stuck. One of the values I need to search for is surrounded by quotes like this: value = "\"value: \"" where backslash would be the escape key in Java. But, in the Roku API docs, I can't seem to find how you search for regex. Can anyone help me with what to use when I'm trying to do:

value = Instr(from_index, string_to_search, "\"value: \"")?

Thanks for your help!

Cheers,
Al
 
User avatar
RokuKevin
Roku Engineering
Posts: 796
Joined: Tue Sep 22, 2009 2:29 pm

Re: Seaching Strings with Escapes

Fri Aug 20, 2010 1:35 pm

We do have a regular expression component roRegEx if that is what you are looking for. The particular case you are asking about doesn't require a regular expression though.... You just need to include the quote character in your string.

The way you to that is with the Chr(34) function (BrightScript doesn't parse the '\' as an escape character).

Example:
search_string = Chr(34)+"value: "+Chr(34)
value = Instr(from_index, string_to_search, search_string)


--Kevin
 
cpawinsal
Topic Author
Posts: 20
Joined: Fri Aug 20, 2010 1:13 pm

Re: Seaching Strings with Escapes

Fri Aug 20, 2010 1:47 pm

Very cool. Thanks for the help. I'll go that way.

Who is online

Users browsing this forum: No registered users and 3 guests