Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
cpawinsal
Visitor

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 2
RokuKevin
Visitor

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
cpawinsal
Visitor

Re: Seaching Strings with Escapes

Very cool. Thanks for the help. I'll go that way.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.