Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
cpawinsal
Level 7

Seaching Strings with Escapes

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
0 Kudos
2 Replies
Highlighted
RokuKevin
Level 9

Re: Seaching Strings with Escapes

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
0 Kudos
Highlighted
cpawinsal
Level 7

Re: Seaching Strings with Escapes

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